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

Address Serilog documentation issues raised as per #3247 #3254

Merged
merged 3 commits into from
Jan 9, 2018

Conversation

wtarr
Copy link
Contributor

@wtarr wtarr commented Jan 6, 2018

  • Address serilog colored console requirement.
  • Remove requirement for "SerilogLogMessageFormatter" as code examples
    appear to run without specifying the formatter.
  • Add an example of how an output template is configured for the
    extensions demo.
  • Remove use of serilog application configuration in code from the hocon
    example, but mention it as a feature of serilog.

- Address serilog colored console requirement.
- Remove requirement for "SerilogLogMessageFormatter" as code examples
appear to run without specifying the formatter.
- Add an example of how an output template is configured for the
extensions demo.
- Remove use of serilog application configuration in code from the hocon
example, but mention it as a feature of serilog.
Copy link
Member

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

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

Don't we need to keep the big about SerilogMessageFormatter?

The following example uses Serilogs __Colored Console__ sink available via nuget, there are wide range of other sinks available depending on your needs, for example a rolling log file sink. See serilogs documentation for details on these.

```
PM> Install-Package Serilog.Sinks.ColoredConsole
Copy link
Member

Choose a reason for hiding this comment

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

Good

```csharp
var log = Context.GetLogger(new SerilogLogMessageFormatter());
Copy link
Member

Choose a reason for hiding this comment

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

Why remove this? Isn't that necessary to get the semantic Serilog-style formatting to work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi, I found when I ran the examples, that it did not seem to make a difference in output whether the formatter was included or not. I felt if it was not necessary or no longer necessary, it was probably best to remove from the example. It seems allot of this structuring of output is handled in serilog - https://github.com/serilog/serilog/wiki/Structured-Data#default-behaviour - some of this page seems to apply to 2.6.0 but the following seems to apply for 2.5.0

Log.Information("The value is {counter}", counter);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

funnily, the following works too

private void Handle(int count)
{
	var log = Context.GetLogger();
	log.Info("Count is {a} {b} {c}", count, 2, true);
}

2018-01-08 18:23:12 INF Count is 1 2 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 see.

Copy link
Member

Choose a reason for hiding this comment

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

Correct. The SerilogLogMessageFormatter is no longer needed.

@Danthar
Copy link
Member

Danthar commented Jan 9, 2018

+1 on @stijnherreman comment. And it is exactly the reason why serilog plugins have not been mentioned in the docs. I am not a fan of pointing people to a specific nuget package in this case. Because its an external project, and we don't want to update our docs everytime one of their plugin's moves somewhere else.

Mention the plugin/extensions name, sure. But don't specify an exact nuget package, imho.

@wtarr
Copy link
Contributor Author

wtarr commented Jan 9, 2018

If you wish I can replace the colored console with the standard console sink as a sink is necessary for output. I would hope that the console sink would be considered a standard sink.

@Danthar
Copy link
Member

Danthar commented Jan 9, 2018

Thats also an option. Not sure if the normal console sink is built in though, i never use it :P Either way im ok with either option.

@wtarr
Copy link
Contributor Author

wtarr commented Jan 9, 2018

To the best of my knowledge, one sink is necessary. There own page mention these two packages as part of there basic setup (https://github.com/serilog/serilog/wiki/Getting-Started).

PM> Install-Package Serilog and PM> Install-Package Serilog.Sinks.Console

I use console myself mostly for testing, but rolling log file in production, it has nice retention handling built in.

@Aaronontheweb Aaronontheweb merged commit 5b531e7 into akkadotnet:dev Jan 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants