Skip to content
New issue

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

scoped/better structured logs #519

Open
bobheadxi opened this issue Sep 30, 2020 · 2 comments
Open

scoped/better structured logs #519

bobheadxi opened this issue Sep 30, 2020 · 2 comments
Labels
theme:refactoring Something needs to be cleaned up or refactored

Comments

@bobheadxi
Copy link
Member

bobheadxi commented Sep 30, 2020

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)

@bobheadxi bobheadxi added the theme:refactoring Something needs to be cleaned up or refactored label Sep 30, 2020
@bobheadxi bobheadxi self-assigned this Oct 17, 2020
@bobheadxi
Copy link
Member Author

@bobheadxi
Copy link
Member Author

Some more logging ideas: ubclaunchpad/life-at-ubc#18 (comment)

@bobheadxi bobheadxi removed their assignment Dec 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme:refactoring Something needs to be cleaned up or refactored
Projects
None yet
Development

No branches or pull requests

1 participant