-
Notifications
You must be signed in to change notification settings - Fork 3
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
New source code logger #110
Open
heifner
wants to merge
1
commit into
main
Choose a base branch
from
heifner-patch-2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# New source code logger | ||
|
||
## Current logger | ||
|
||
* fc::logger | ||
** Console logging both stderr & stdout | ||
** GELF logging | ||
** Deep-mind logging to a file | ||
** Works with fc::variant for logging any FC_REFLECT type | ||
|
||
Could enhance fc::logger to add file support, file rotation, async logging, filtering, etc. OR switch to a third-party open source logger. | ||
|
||
## New logger | ||
|
||
Evaluate existing open source log libraries. `spdlog` (https://github.com/gabime/spdlog) has been used by core team in the past on other projects. | ||
|
||
## Integration | ||
|
||
`spdlog` uses `fmt` library which is part of C++20 or is available as a separate third-party library (https://github.com/fmtlib/fmt). | ||
The switch to `fmt` instead of `fc::variant` will require providing a mapping between FC_REFLECT and `fmt`. | ||
A start of that work can be found at | ||
* https://github.com/EOSIO/fc/tree/kjh-epe-291-fc | ||
* https://github.com/EOSIO/fc/commits/jjz-epe-2012-new-logging-library-fc | ||
* https://github.com/EOSIO/eos/tree/kjh-epe-291-log | ||
|
||
Existing fc_xlog macros could be updated to use `spdlog` or just use spdlog macros directly. | ||
|
||
`spdlog` does not include a GELF logger. However, since our current GELF logger is hand-written it should be simple enough to add a new sink type to `spdlog`. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is part of c++20 but sadly is still not present in the latest versions of libstdc++ nor libc++, so realistically we'll need to use the third party library for the next 4+ years.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to me that it would be better than the alternative (of not using
std::format
orfmtlib
)