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

json log format #115

Closed
wants to merge 6 commits into from
Closed

json log format #115

wants to merge 6 commits into from

Conversation

nnshah1
Copy link
Contributor

@nnshah1 nnshah1 commented Apr 19, 2024

No description provided.

@nnshah1 nnshah1 marked this pull request as draft April 19, 2024 14:35
@nnshah1 nnshah1 requested a review from rmccorm4 April 19, 2024 14:35
src/logging.cc Outdated Show resolved Hide resolved
WriteBuffer, rapidjson::UTF8<>, rapidjson::UTF8<>,
rapidjson::CrtAllocator, writeFlags>
writer(writebuffer);
writer.String(input.c_str());
Copy link
Contributor

Choose a reason for hiding this comment

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

I was going to ask if this can fail if the input has some malformed or half-formed JSON in it, but it seems like it won't: Tencent/rapidjson#1767 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

error handling was a little tricky w.r.t to we usually log an error - so I didn't want to create a recursion by accident. Writing and error causes an error .... so would probably have to fail silently ... or print directly to the stdout ...

@@ -125,7 +129,10 @@ class Logger {
// Flush the log.
void Flush();

static const std::array<const char*, Level::kINFO + 1> LEVEL_NAMES;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should have defined Level:kEND then use it instead of Level::kINFO + 1, easy to miss if someone adds new log level and doesn't change there.

@nnshah1
Copy link
Contributor Author

nnshah1 commented May 15, 2024

continued in new PR

@nnshah1 nnshah1 closed this May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants