We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I needed to switch logging to syslog, and added code to do that:
LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'formatters': { 'verbose': { 'format': '%(levelname)s %(module)s P%(process)d T%(thread)d %(message)s' }, }, 'handlers': { 'stdout': { 'class': 'logging.StreamHandler', 'stream': sys.stdout, 'formatter': 'verbose', }, 'sys-logger6': { 'class': 'logging.handlers.SysLogHandler', "address": ["127.0.0.1", 514], 'facility': "local6", 'formatter': 'verbose', }, }, 'loggers': { 'my-logger': { 'handlers': ['sys-logger6', 'stdout'], 'level': logging.DEBUG, 'propagate': True, }, } }
logging.config.dictConfig(LOGGING) my_logger = logging.getLogger('my-logger')
def _logger(name, level, msg, exc_info=None): elapsed = time.monotonic() - start_time hours = int(elapsed // 60) seconds = elapsed - (hours * 60) my_logger.log(level, f'{os.getpid()} - {hours:3}:{seconds:06.3f} {name:20} {msg}', exc_info=exc_info)
this could easily be put into a json config file.
is that a desired feature? i could provide a patch.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I needed to switch logging to syslog, and added code to do that:
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format': '%(levelname)s %(module)s P%(process)d T%(thread)d %(message)s'
},
},
'handlers': {
'stdout': {
'class': 'logging.StreamHandler',
'stream': sys.stdout,
'formatter': 'verbose',
},
'sys-logger6': {
'class': 'logging.handlers.SysLogHandler',
"address": ["127.0.0.1", 514],
'facility': "local6",
'formatter': 'verbose',
},
},
'loggers': {
'my-logger': {
'handlers': ['sys-logger6', 'stdout'],
'level': logging.DEBUG,
'propagate': True,
},
}
}
logging.config.dictConfig(LOGGING)
my_logger = logging.getLogger('my-logger')
def _logger(name, level, msg, exc_info=None):
elapsed = time.monotonic() - start_time
hours = int(elapsed // 60)
seconds = elapsed - (hours * 60)
my_logger.log(level, f'{os.getpid()} - {hours:3}:{seconds:06.3f} {name:20} {msg}', exc_info=exc_info)
this could easily be put into a json config file.
is that a desired feature? i could provide a patch.
The text was updated successfully, but these errors were encountered: