-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
I'm trying to refactor some code that uses the standard logging.getLogger to use lithoxyl and I'm a bit stuck without some more examples comparing the old style with the new.
In particular, how should I go about converting code that looks like:
logger.info('starting some process')
logger.debug('intermediate result %d', a)
logger.debug('another intermediate result %s', b)
logger.info('complete')
Logging the start/finish is fine, but I'm stuck on the "right" way to log the intermediate results. Should they just be assigned to Action's data:
with app_log.info('process') as act:
act['intermediate result'] = a
act.success()
That feels a bit clunky as the resulting repr of the data in the log line is pretty unreadable and out of order.
Or can warn be used? It doesn't seem quite like it does what I want as it has a different level than the Action and it's not outputting how I would expect.
with app_log.info('process') as act:
act.warn('intermediate result %d', a)
act.success()
Metadata
Metadata
Assignees
Labels
No labels