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

Allow the logger to inject tags into the logs #145

Merged
merged 2 commits into from
May 7, 2015

Conversation

mfine
Copy link
Contributor

@mfine mfine commented May 7, 2015

Add a tags parameter to Base logger and use it in JSON logger. It's a string of tags separated by commas used to decorate the logs with. This results in something like:

tags=WUT=now,HI=hater

generates:

{"timestamp": 1431022699, "WUT": "now", "HI": "hater", "data": ...

This will be used to inject session data into the logs, namely session_id. There's some questions here on whether to nest these tags and metadata - we can update that as necessary.

/cc @mookerji

@swiftnav-jenkins
Copy link
Contributor

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
http://zazu.ci.swiftnav.com/job/libsbp_Pull_Requests/100/
Test PASSed.

return {"delta": self.delta(),
"timestamp": self.timestamp(),
"data": data}
msg = {"delta": self.delta(), "timestamp": self.timestamp(), "data": data}
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmmm, I think there's a risk here of tags stamping over some existing keys (delta, timestamp, data).

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with your nesting suggestion, probably having something like 'tags' with msg = {"delta": self.delta(), "tags": .}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I actually reversed it - but then thought that might be desirable to overwrite. But probably not.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a metadata field, and always populate it, even if empty. tags is a little arbitrary - metadata fits nicer with data. Potentially header could be used here, too.

@swiftnav-jenkins
Copy link
Contributor

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
http://zazu.ci.swiftnav.com/job/libsbp_Pull_Requests/101/
Test PASSed.

mookerji added a commit that referenced this pull request May 7, 2015
Allow the logger to inject tags into the logs
@mookerji mookerji merged commit 966e09c into swift-nav:master May 7, 2015
silverjam pushed a commit that referenced this pull request Feb 13, 2023
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.

None yet

3 participants