Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
**A few questions before you begin:**

> Is this an issue related to the Serilog core project or one of the [sinks](https://github.com/serilog/serilog/wiki/Provided-Sinks) or [community projects](https://github.com/serilog/serilog/wiki/Community-Projects). This issue list is intended for Serilog core issues. If this issue relates to a sink or related project, please log on the related repository. Please use [Gitter chat](https://gitter.im/serilog/serilog) and [Stack Overflow](http://stackoverflow.com/questions/tagged/serilog) for discussions and questons.

**Does this issue relate to a new *feature* or an existing *bug*?**
- [ ] Bug
- [ ] New Feature

**What version of Serilog Console Sink is affected by this issue? Please list the related NuGet package.**

**What is the target framework and operating system affected by this issue? Please see [target frameworks](https://docs.microsoft.com/en-us/nuget/schema/target-frameworks) & [net standard matrix](https://docs.microsoft.com/en-us/dotnet/standard/net-standard).**

- [ ] netCore 2.0
- [ ] netCore 1.0
- [ ] 4.7
- [ ] 4.6.x
- [ ] 4.5.x

**Please describe the current behaviour you are experiencing?**

**Please describe the expected behaviour if the ?**

**If the current behavior is a bug, please provide the steps to reproduce the issue and if possible a minimal demo of the problem**
*NOTE: A small code sample goes a long way in expediting bug fixes or illustrating an enhancement you are proposing.*
12 changes: 12 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
**What issue does this PR address?**
*Please list any GitHub issues here*

**Does this PR introduce a breaking change?**
*Please list any changes that may cause issues for users, including binary breaking changes*

**Please check if the PR fulfills these requirements**
- [ ] The commit follows our [guidelines](https://github.com/serilog/serilog-sinks-console/blob/dev/CONTRIBUTING.md)
- [ ] Unit Tests for the changes have been added (for bug fixes / features)

**Other information**:
*Please list any other relevant information here*
8 changes: 6 additions & 2 deletions Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ foreach ($src in ls src/*) {
echo "build: Packaging project in $src"

& dotnet build -c Release --version-suffix=$buildSuffix
& dotnet pack -c Release --include-symbols -o ..\..\artifacts --version-suffix=$suffix --no-build
if ($suffix) {
& dotnet pack -c Release --include-source -o ..\..\artifacts --version-suffix=$suffix --no-build
} else {
& dotnet pack -c Release --include-source -o ..\..\artifacts --no-build
}
if($LASTEXITCODE -ne 0) { exit 1 }

Pop-Location
Expand All @@ -41,4 +45,4 @@ foreach ($test in ls test/*.Tests) {
Pop-Location
}

Pop-Location
Pop-Location
3 changes: 3 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Code of Conduct

Please refer to the [Serilog Code of Conduct](https://github.com/serilog/serilog/blob/dev/CONTRIBUTING.md) which covers all repositories within the Serilog Organisation.
52 changes: 52 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Contributing to the Serilog Console Sink

First of all thanks for dropping by, feel free to checkout [Serilog core project's contributing page](https://github.com/serilog/serilog/blob/dev/CONTRIBUTING.md) which contains some key points about the organisation.

## Reporting an issue

Bugs are tracked via [GitHub][issue_list] issues. Below are some notes to help create a new issue. The issue template will help you on the way.

* Create an issue via the [issues list][create_issue].
* List the version of Serilog that is affected
* List the target framework and operating system
* If possible, provide a sample that reproduces the issue.

## Requesting a feature/enhancement

Feature as also tracked via [GitHub][issue_list] issues. Below are some notes to help create an issue. The issue template will help you on the way

* Create an issue via the [issues list][create_issue].
* List the version of Serilog that is affected
* List the target framework and operating system
* If possible, provide a sample that reproduces the issue.

## Making a PR

* If an issue does not already exist please create one via the issues list.
* Fork the repository and create a branch with a descriptive name.
* Attempt to make commits of logical units.
* When committing, please reference the issue the commit relates to.
* Run the build and tests.
* Windows platforms can use the `build.ps1` script. (This is the script used in AppVeyor builds)
* nix/OSX platforms can use the `build.sh` script. (This is the script used in Travis builds)
* Create the PR, the PR template will help provide a stub of what information is required including:
* The issue this PR addresses
* Unit Tests for the changes have been added.

## Questions?

Serilog has an active and helpful community who are happy to help point you in the right direction or work through any issues you might encounter. You can get in touch via:

* [Stack Overflow](http://stackoverflow.com/questions/tagged/serilog) - this is the best place to start if you have a question
* Our [issue tracker](https://github.com/serilog/serilog/issues) here on GitHub
* [Gitter chat](https://gitter.im/serilog/serilog)
* The [#serilog tag on Twitter](https://twitter.com/search?q=%23serilog)

Finally when contributing please keep in mind our [Code of Conduct][serilog_code_of_conduct].

[serilog]: https://github.com/serilog/serilog
[sinks]: https://github.com/serilog/serilog/wiki/Provided-Sinks
[community_projects]: https://github.com/serilog/serilog/wiki/Community-Projects
[create_issue]: https://github.com/serilog/serilog-sinks-console/issues/new
[issue_list]: https://github.com/serilog/serilog-sinks-console/issues/
[serilog_code_of_conduct]: https://github.com/serilog/serilog/blob/dev/CODE_OF_CONDUCT.md
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ To achieve output identical to version 2 of this sink, specify a formatter and o

This will bypass theming and use Serilog's built-in message template formatting.

### Contributing

Would you like to help make the Serilog console sink even better? We keep a list of issues that are approachable for newcomers under the [up-for-grabs](https://github.com/serilog/serilog-sinks-console/issues?labels=up-for-grabs&state=open) label. Before starting work on a pull request, we suggest commenting on, or raising, an issue on the issue tracker so that we can help and coordinate efforts. For more details check out our [contributing guide](CONTRIBUTING.md).

When contributing please keep in mind our [Code of Conduct](CODE_OF_CONDUCT.md).


### Detailed build status

Branch | AppVeyor | Travis
Expand Down
3 changes: 2 additions & 1 deletion src/Serilog.Sinks.Console/Serilog.Sinks.Console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<Description>A Serilog sink that writes log events to the console/terminal.</Description>
<VersionPrefix>3.1.0</VersionPrefix>
<VersionPrefix>3.1.1</VersionPrefix>
<Authors>Serilog Contributors</Authors>
<TargetFrameworks>net45;netstandard1.3;netcoreapp1.1</TargetFrameworks>
<AssemblyName>Serilog.Sinks.Console</AssemblyName>
Expand Down Expand Up @@ -38,6 +38,7 @@

<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,12 @@ public int FormatLiteralValue(ScalarValue scalar, TextWriter output, string form
if (value is string str)
{
using (ApplyStyle(output, ConsoleThemeStyle.String, ref count))
JsonValueFormatter.WriteQuotedJsonString(str, output);
{
if (format != "l")
JsonValueFormatter.WriteQuotedJsonString(str, output);
else
output.Write(str);
}
return count;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System.IO;
using Serilog.Events;
using Serilog.Sinks.SystemConsole.Formatting;
using Serilog.Sinks.SystemConsole.Themes;
using Xunit;

namespace Serilog.Sinks.Console.Tests.Formatting
{
public class ThemedDisplayValueFormatterTests
{
[Theory]
[InlineData("Hello", null, "\"Hello\"")]
[InlineData("Hello", "l", "Hello")]
public void StringFormattingIsApplied(string s, string format, string expected)
{
var f = new ThemedDisplayValueFormatter(ConsoleTheme.None, null);
var sw = new StringWriter();
f.FormatLiteralValue(new ScalarValue(s), sw, format);
var actual = sw.ToString();
Assert.Equal(expected, actual);
}
}
}