clamp-orchestrator/clamp-core

Introduce logs to log information in structured way

priyaaank opened this issue · 1 comments

Is your feature request related to a problem? Please describe.
Clamp currently does not have a structured logging mechanism, this issue requests that logging should be done in a structured way and can be used/attached in case of issues that users may face while using the library.

Describe the solution you'd like
There are several aspects that are important to consider as a logging structure is set up

  • Log level should be provided as an environment variable to the clamp core. This way debug logs should be enabled whenever needed.
  • Configuration should be supported to either log to a file or to the STDOUT/STDERR
  • Log files should be rotated to ensure that they can be periodically cleaned up without running out of space. The logging policy should be configurable.
  • Format for logging should be structured so that in case the logs are aggregated centrally, they can be made queriable.

Describe alternatives you've considered
Alternatives are that logs are always sent to STDOUT, which means that OS will redirect the logs to the default logging file.

Additional context
None

@priyaaank I had great success using logrus in my previous project. It is one of the widely used logging libraries in the Go ecosystem. There are faster alternatives like zap, zerolog, etc. But I feel logrus would suit better for Clamp.

Migrating existing implementation won't be a big effort in my analysis. logrus provides Printf and Println functions. So, it should be a drop-in replacement.