Skip to content
This repository was archived by the owner on Dec 13, 2018. It is now read-only.

Debug logger #207

Merged
merged 1 commit into from
Jul 1, 2015
Merged

Debug logger #207

merged 1 commit into from
Jul 1, 2015

Conversation

victorhurdugaci
Copy link
Contributor


string message;
var values = state as ILogValues;
if (formatter != null)
Copy link
Member

Choose a reason for hiding this comment

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

That attribute throws if the value is null, here it is actually optional.

@victorhurdugaci
Copy link
Contributor Author

Updated

return;
}

message = $"{ logLevel }: {message}";
Copy link
Member

Choose a reason for hiding this comment

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

take a look at the following recently merged in external PR and see if we should do something like that for log level:
400e191

Copy link
Member

Choose a reason for hiding this comment

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

nit: extra whitespace in the placeholders here.

Copy link
Member

Choose a reason for hiding this comment

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

@kichalla that doesn't make as much sense here as we're passing the _name through to the underlying Debug.WriteLine call as the category, so we're not controlling the left-hand side "column" width like we do in the console logger.

@kichalla
Copy link
Member

Looks good to me. :shipit:

@victorhurdugaci victorhurdugaci force-pushed the victorhu/debug-logger branch from 0cd3ad2 to 5e1b4e2 Compare July 1, 2015 00:30
@victorhurdugaci victorhurdugaci merged commit 5e1b4e2 into dev Jul 1, 2015
@victorhurdugaci victorhurdugaci deleted the victorhu/debug-logger branch July 1, 2015 00:40
public DebugLogger(string name, Func<string, LogLevel, bool> filter)
{
_name = string.IsNullOrEmpty(name) ? nameof(DebugLogger) : name;
_filter = filter ?? ((category, logLevel) => true);
Copy link
Member

Choose a reason for hiding this comment

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

I think we should just leave _filter as null and check for it in IsEnabled rather than assign a default true returning delegate. Why run anything at all when checking IsEnabled if we can just check for null?

_filter = filter;
}

public ILogger CreateLogger(string name)
Copy link
Member

Choose a reason for hiding this comment

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

Add doc comments.

@@ -0,0 +1,20 @@
{
"version": "1.0.0-*",
"dependencies": {
Copy link
Member

Choose a reason for hiding this comment

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

Add a description to this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants