Skip to content

Commit

Permalink
fixes and minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
csm10495 committed Dec 22, 2022
1 parent 16e50c8 commit 4afdc21
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ Note that logs may be delayed due to rate limiting, etc. If you are logging *a l


## Customized Child Loggers
`setup()` has an optional parameter: `modifyChildLoggersFunc`. If it is given, it must be a function that would take in each created child logger
and return a child logger. This can be used to add additional things like handlers to each child logger.
`setup()` has an optional parameter: `modifyChildLoggersFunc`. If it is given, it must be a function that would take in as a single arg, each created child logger. This can be used to add additional things like handlers to each child logger. (Note that the child logger is modified in place).

## Installation
```
Expand Down
8 changes: 5 additions & 3 deletions csmlog/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from csmlog.udp_handler import UdpHandler
from csmlog.udp_handler_receiver import UdpHandlerReceiver

__version__ = "0.26.0"
__version__ = "0.27.0"

DEFAULT_LOG_FORMAT = "%(asctime)s - %(name)s:%(lineno)d - %(levelname)s - %(message)s"

Expand Down Expand Up @@ -74,7 +74,7 @@ def getLogger(self, name):
logger.sysCall = LoggedSystemCall(logger)

if self.modifyChildLoggersFunc:
logger = self.modifyChildLoggersFunc(logger)
self.modifyChildLoggersFunc(logger)

return logger

Expand Down Expand Up @@ -274,6 +274,7 @@ def setup(
clearLogs=False,
udpLogging=True,
googleSheetShareEmail=None,
formatter=None,
modifyChildLoggersFunc=None,
):
"""must be called to setup the logger. Passes args to CSMLogger's constructor"""
Expand All @@ -289,7 +290,8 @@ def setup(
clearLogs,
udpLogging,
googleSheetShareEmail,
modifyChildLoggersFunc,
formatter=formatter,
modifyChildLoggersFunc=modifyChildLoggersFunc,
)
self._activeCsmLogger.parentLogger.debug("==== %s is starting ====" % appName)

Expand Down
1 change: 0 additions & 1 deletion csmlog/tests/test_csmlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ def test_formatter_setting(csmlog):
def test_modify_child_loggers_func(csmlog):
def _tmp(logger):
logger.lolcats = "lolcats"
return logger

csmlog.modifyChildLoggersFunc = _tmp

Expand Down

0 comments on commit 4afdc21

Please sign in to comment.