anz-bank / pkg

Common ANZ Go packages
https://pkg.go.dev/github.com/anz-bank/pkg
Apache License 2.0
2 stars 9 forks source link

basic logger library #1

Closed nofun97 closed 4 years ago

nofun97 commented 4 years ago

Changes proposed in this pull request:

  1. Added a basic library for logging that enforces the use of context
  2. Added an underlying logger (logrus Standard Logger)

Features of the logger:

  1. Putting logger in context and uses context to do logging
  2. Context-level fields (global fields)
  3. Log-level fields (fields that are not stored in context's logger)

Further work required:

  1. Add a way to log fields directly from context (global fields)
  2. Add test logger (similar to logrus' test logger)
  3. Add codelinker to the library so that each logging message can link itself to the part of the code where the log was executed
  4. Add configurable loggers feature
  5. Add colors to the messages (not a priority unless requested)
nofun97 commented 4 years ago

WithField is removed to avoid bad practice of using WithField too many times