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

feat(basic-tracer): configure logger #183

Merged
merged 3 commits into from
Aug 14, 2019

Conversation

mayurkale22
Copy link
Member

No description provided.

@codecov-io
Copy link

codecov-io commented Aug 9, 2019

Codecov Report

Merging #183 into master will decrease coverage by 0.65%.
The diff coverage is 89.65%.

@@            Coverage Diff             @@
##           master     #183      +/-   ##
==========================================
- Coverage   93.72%   93.06%   -0.66%     
==========================================
  Files          50       50              
  Lines        1609     1515      -94     
  Branches      100      100              
==========================================
- Hits         1508     1410      -98     
- Misses        101      105       +4
Impacted Files Coverage Δ
...pentelemetry-basic-tracer/test/BasicTracer.test.ts 100% <100%> (ø) ⬆️
...ages/opentelemetry-basic-tracer/src/BasicTracer.ts 95.83% <100%> (+0.08%) ⬆️
...kages/opentelemetry-basic-tracer/test/Span.test.ts 100% <100%> (ø) ⬆️
packages/opentelemetry-basic-tracer/src/Span.ts 86.66% <40%> (-6.07%) ⬇️


/** Constructs a new Span instance. */
constructor(
parentTracer: types.Tracer,
logger: Logger,
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make sense to put this at the end and give it a default value, e.g. the NoopLogger? Or do you think it needs to be required with no default?

Copy link
Member

Choose a reason for hiding this comment

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

I'm not a fan of hiding logs by default. Maybe it could be some kind of ConsoleLogger by default? Then if the user prefers to use their own logger they can change it. The main issue with this approach is that console doesn't have a log level, but that could be configured on the ConsoleLogger with a default of ERROR or WARN.

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe that console itself does implement our Logger interface, and it has an implicit level of DEBUG since it will just print all messages.

So what if we had something like this in some utility file:

export const WARN_LEVEL_CONSOLE_LOGGER = console;

I'm trying to avoid extra layers of wrapping to keep the code minimal if we can, though I'm open to it.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm trying to avoid extra layers of wrapping to keep the code minimal if we can, though I'm open to it.

I think the only problem with this is you can't configure the log level. I am in favor of adding ConsoleLogger (may be same as https://github.com/census-instrumentation/opencensus-node/blob/master/packages/opencensus-core/src/common/console-logger.ts#L25). Let me know I can it in same PR.

Copy link
Member

Choose a reason for hiding this comment

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

I'm trying to avoid extra layers of wrapping to keep the code minimal if we can

The wrapper would not do much except add the concept of a log level to console.

Copy link
Member

Choose a reason for hiding this comment

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

This should probably be discussed in a new issue to unblock this PR. Let's leave it required for now.

Copy link
Member Author

Choose a reason for hiding this comment

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

Created issue to track #197

@mayurkale22 mayurkale22 merged commit b498ba2 into open-telemetry:master Aug 14, 2019
@mayurkale22 mayurkale22 deleted the add_logger branch August 14, 2019 15:28
pichlermarc pushed a commit to dynatrace-oss-contrib/opentelemetry-js that referenced this pull request Dec 15, 2023
Signed-off-by: Naseem <naseem@transit.app>
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.

4 participants