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

Connect tracer with external application's logging facilities #150

Merged
merged 10 commits into from
Jan 23, 2021

Conversation

cgilmour
Copy link
Contributor

This PR adds logging functionality that allows the tracer library to emit log messages using the application's logger.
When initializing the tracer, the application provides a log function that is used as a bridge between the library and application. Then if the tracer needs to write a log message, it calls the application-provided log function with a log level and message.

This also improves the startup logging, so instead of writing to a file, it is written to the application's logs.

There's two sets of methods to use when logging something.
Log should be used for actionable information.
Trace should be used for detailing the call flow and internal decision-making.

The logger is instantiated as either a StandardLogger or VerboseLogger. The StandardLogger provides an empty implementation for the Trace methods, which means there's no significant overhead to calling them - it becomes almost a no-op.
The DD_TRACE_DEBUG environment variable needs to be set to true to use the VerboseLogger and have the performance impact of the detailed logging.

There are still occasions where stderr is used, and places where Trace could be used, and this will be covered in future PRs.

@cgilmour cgilmour added this to the 1.2.1 milestone Sep 23, 2020
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.

2 participants