Example scenario: I'm looking at #510 and want to look at all logs associated with all user edit and team refresh commands. Seems rather nontrivial to do without knowing a list of all the function names involved at the moment, since our current logs just have the context:
{utils.get_team_by_name():33 /app/db/utils.py}
This does not tell me very much about who called the function, or which request this event happened in, and so on.
I do this in other projects by parameterizing and propagating loggers. For example:
func A():
log = logger.new("field0", "A")
B(logger.new("field1", "B"))
func B(log):
C(log.new("field2", "C"))
func C(log):
log.print("hello world") # time=X, hello world, field0=A, field1=B, field2=C
This makes it much easier to scope down categories of events (starting at A, A including B, all 3)
Example scenario: I'm looking at #510 and want to look at all logs associated with all
user editandteam refreshcommands. Seems rather nontrivial to do without knowing a list of all the function names involved at the moment, since our current logs just have the context:This does not tell me very much about who called the function, or which request this event happened in, and so on.
I do this in other projects by parameterizing and propagating loggers. For example:
This makes it much easier to scope down categories of events (starting at A, A including B, all 3)