Skip to content

Conversation

@chauhan17nitin
Copy link
Contributor

@chauhan17nitin chauhan17nitin commented Jan 8, 2023

Resolved #49

@chauhan17nitin
Copy link
Contributor Author

@uzaxirr @abhi-shek-raj @abhishekraj272 kindly check.

Copy link
Member

@abskrj abskrj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious
What is difference between go's default logger and zapper?
Can you also paste a snapshot of Zapper's output

@akshat2602
Copy link
Contributor

akshat2602 commented Jan 13, 2023

@abhishekraj272 Just to chime in here, Zap is considered the gold standard for logging. Some of the issues that the default logger has are -

  1. Very basic logging.
  2. Limited log levels. There is no way to categorize messages into Info, Warning, Fatal, Errors, and so on.
  3. During exception, by using the Fatal or Panic methods, the application exits. There is no way to log an error message without quitting the application.
  4. Primitive Message Formatting. No way to include stack trace, formatted date-time and adding in additional context.
    I'm sure @chauhan17nitin can give specific pointers as to why Zap is the gold standard

@chauhan17nitin
Copy link
Contributor Author

Thanks @akshat2602

Yep Zap is surely better than default go's logger
-> structured logging as json objects using which you can also feed data into elastic easily, to get it fast searchable on fields.
-> passing of data with message surely lot easier then default logger
-> different log levels is also one of the major factor (though i have currently implemented debug, info and error only in this PR :P)
-> In debug logs it gives a good stacktrace if context used properly in code :D

sample of zap log
image

@uzaxirr
Copy link
Member

uzaxirr commented Jan 17, 2023

@chauhan17nitin

This looks fine but we can only proceed with this once we have a nice code coverage through test cases ;(
Alternatively you can split this PR into many
One for just introducing the logger and add more logging statements in subsequent PRs so that it is easy to review and make sure that no other things are affected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Logging via Zap Logger

4 participants