Skip to content

Commit

Permalink
Merge branch 'dev' into nuget-license
Browse files Browse the repository at this point in the history
  • Loading branch information
nblumhardt committed May 19, 2019
2 parents 06ade79 + 8ce1bce commit fa506c8
Show file tree
Hide file tree
Showing 111 changed files with 597 additions and 702 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ insert_final_newline = true
indent_style = space
indent_size = 4

[*.{csproj,json,config,yml}]
[*.{csproj,json,config,yml,props}]
indent_size = 2

[*.sh]
Expand Down
13 changes: 0 additions & 13 deletions .travis.yml

This file was deleted.

3 changes: 3 additions & 0 deletions Build.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
echo "build: Build started"

& dotnet --info
& dotnet --list-sdks

Push-Location $PSScriptRoot

if(Test-Path .\artifacts) {
Expand Down
6 changes: 3 additions & 3 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* #939, #946, #972 - RTM .NET Standard/Core tooling
* #955 - `LoggerSinkConfiguration.Wrap()`
* #944 - `{Properties}` in output templates
* #961 - fix parser exeception when property tokens with zero-length names are encountered
* #961 - fix parser exception when property tokens with zero-length names are encountered
* #773 - `LogContext.Clone()` and `LogContext.Push(ILogEventEnricher)`
* #976 - support for logging C# 7 `ValueTuple<>` values
* #977 - output formatting performance improvements, `{Message:l}` (unquoted string) and `{Message:j}` (JSON structure) support in output templates
Expand Down Expand Up @@ -138,7 +138,7 @@ Plus multiple build/test/configuration improvements.2.4.0
* #402 - `<appSettings>` configuration support now in the Serilog package

1.4.214
* #344 - Moved "Extras" including Web, Owin, F#, destructuring to new organisations
* #344 - Moved "Extras" including Web, Owin, F#, destructuring to new organizations

1.4.204
* #344 (partial) - Moved remaining sinks to individual repositories
Expand Down Expand Up @@ -249,7 +249,7 @@ Plus multiple build/test/configuration improvements.2.4.0
* #229 - Created net40 version of Extras Topshelf
* #236 - Ensure dictionary keys are quoted in JSON even when they're numeric
* #237 - When `JsonFormatter` formats a dictionary of `<int, object>`, the key should be double quoted
* #235 - Fixed serialization of dicationary keys in ES and similar sinks
* #235 - Fixed serialization of dictionary keys in ES and similar sinks

1.4.11
* #238 - Dynamic level switching
Expand Down
3 changes: 3 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@
</ItemGroup>
<!-- Workaround for https://github.com/dotnet/sdk/pull/908 -->
<Target Name="GetPackagingOutputs" />
<PropertyGroup>
<LangVersion>latest</LangVersion>
</PropertyGroup>
</Project>
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ Serilog has an active and helpful community who are happy to help point you in t
* 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)
* [Serilog-related courses on Pluralsight](https://www.pluralsight.com/search/?q=serilog)

### Contributing

Expand All @@ -111,9 +112,9 @@ When contributing please keep in mind our [Code of Conduct](CODE_OF_CONDUCT.md).

### Detailed build status

Branch | AppVeyor | Travis
------------- | ------------- |-------------
dev | [![Build status](https://ci.appveyor.com/api/projects/status/b9rm3l7kduryjgcj/branch/dev?svg=true)](https://ci.appveyor.com/project/serilog/serilog/branch/dev) | [![Build Status](https://travis-ci.org/serilog/serilog.svg?branch=dev)](https://travis-ci.org/serilog/serilog)
master | [![Build status](https://ci.appveyor.com/api/projects/status/b9rm3l7kduryjgcj/branch/master?svg=true)](https://ci.appveyor.com/project/serilog/serilog/branch/master) | [![Build Status](https://travis-ci.org/serilog/serilog.svg?branch=master)](https://travis-ci.org/serilog/serilog)
Branch | AppVeyor
------------- | -------------
dev | [![Build status](https://ci.appveyor.com/api/projects/status/b9rm3l7kduryjgcj/branch/dev?svg=true)](https://ci.appveyor.com/project/serilog/serilog/branch/dev)
master | [![Build status](https://ci.appveyor.com/api/projects/status/b9rm3l7kduryjgcj/branch/master?svg=true)](https://ci.appveyor.com/project/serilog/serilog/branch/master)

_Serilog is copyright &copy; 2013-2018 Serilog Contributors - Provided under the [Apache License, Version 2.0](http://apache.org/licenses/LICENSE-2.0.html). Needle and thread logo a derivative of work by [Kenneth Appiah](http://www.kensets.com/)._
1 change: 0 additions & 1 deletion Serilog.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "assets", "assets", "{E9D1B5E1-DEB9-4A04-8BAB-24EC7240ADAF}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.travis.yml = .travis.yml
appveyor.yml = appveyor.yml
Build.ps1 = Build.ps1
build.sh = build.sh
Expand Down
19 changes: 14 additions & 5 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
version: '{build}'
skip_tags: true
image: Visual Studio 2017
image:
- Visual Studio 2017
- Ubuntu
configuration: Release
test: off
build_script:
- ps: ./Build.ps1
- ps: ./BuildNativeUWP.ps1
- ps: ./Build.ps1
- ps: ./BuildNativeUWP.ps1
for:
-
matrix:
only:
- image: Ubuntu
build_script:
- sh build.sh
artifacts:
- path: artifacts/Serilog.*.nupkg
- path: artifacts/Serilog.*.nupkg
deploy:
- provider: NuGet
api_key:
secure: bd9z4P73oltOXudAjPehwp9iDKsPtC+HbgshOrSgoyQKr5xVK+bxJQngrDJkHdY8
secure: N59tiJECUYpip6tEn0xvdmDAEiP9SIzyLEFLpwiigm/8WhJvBNs13QxzT1/3/JW/
skip_symbols: true
on:
branch: /^(master|dev)$/
Expand Down
3 changes: 3 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@

set -e
dotnet --info
dotnet --list-sdks
dotnet restore

echo "🤖 Attempting to build..."
for path in src/**/*.csproj; do
dotnet build -f netstandard1.0 -c Release ${path}
dotnet build -f netstandard1.3 -c Release ${path}
done

echo "🤖 Running tests..."
for path in test/*.Tests/*.csproj; do
dotnet test -f netcoreapp2.0 -c Release ${path}
done
Expand Down
2 changes: 1 addition & 1 deletion src/Serilog/Capturing/DepthLimiter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class DepthLimiter : ILogEventPropertyValueFactory
{
[ThreadStatic]
static int _currentDepth;

readonly int _maximumDestructuringDepth;
readonly PropertyValueConverter _propertyValueConverter;

Expand Down
10 changes: 8 additions & 2 deletions src/Serilog/Capturing/GetablePropertyFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,14 @@ internal static IEnumerable<PropertyInfo> GetPropertiesRecursive(this Type type)
yield return propertyInfo;
}

currentTypeInfo = currentTypeInfo.BaseType.GetTypeInfo();
var baseType = currentTypeInfo.BaseType;
if (baseType == null)
{
yield break;
}

currentTypeInfo = baseType.GetTypeInfo();
}
}
}
}
}
5 changes: 2 additions & 3 deletions src/Serilog/Capturing/PropertyBinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ IEnumerable<LogEventProperty> ConstructPositionalProperties(MessageTemplate temp
var result = new LogEventProperty[messageTemplateParameters.Length];
foreach (var property in positionalProperties)
{
int position;
if (property.TryGetPositionalValue(out position))
if (property.TryGetPositionalValue(out int position))
{
if (position < 0 || position >= messageTemplateParameters.Length)
SelfLog.WriteLine("Unassigned positional value {0} in: {1}", position, template);
Expand Down Expand Up @@ -111,7 +110,7 @@ IEnumerable<LogEventProperty> ConstructNamedProperties(MessageTemplate template,
{
var property = template.NamedProperties[i];
var value = messageTemplateParameters[i];
result[i] = ConstructProperty(property, value);
result[i] = ConstructProperty(property, value);
}

for (var i = matchedRun; i < messageTemplateParameters.Length; ++i)
Expand Down
11 changes: 5 additions & 6 deletions src/Serilog/Capturing/PropertyValueConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ partial class PropertyValueConverter : ILogEventPropertyFactory, ILogEventProper
readonly bool _propagateExceptions;

public PropertyValueConverter(
int maximumDestructuringDepth,
int maximumDestructuringDepth,
int maximumStringLength,
int maximumCollectionCount,
IEnumerable<Type> additionalScalarTypes,
Expand All @@ -63,7 +63,7 @@ partial class PropertyValueConverter : ILogEventPropertyFactory, ILogEventProper
if (maximumDestructuringDepth < 0) throw new ArgumentOutOfRangeException(nameof(maximumDestructuringDepth));
if (maximumStringLength < 2) throw new ArgumentOutOfRangeException(nameof(maximumStringLength));
if (maximumCollectionCount < 1) throw new ArgumentOutOfRangeException(nameof(maximumCollectionCount));

_propagateExceptions = propagateExceptions;
_maximumStringLength = maximumStringLength;
_maximumCollectionCount = maximumCollectionCount;
Expand All @@ -76,7 +76,7 @@ partial class PropertyValueConverter : ILogEventPropertyFactory, ILogEventProper
};

_destructuringPolicies = additionalDestructuringPolicies
.Concat(new IDestructuringPolicy []
.Concat(new IDestructuringPolicy[]
{
new DelegateDestructuringPolicy(),
new ReflectionTypesScalarDestructuringPolicy()
Expand Down Expand Up @@ -169,7 +169,7 @@ LogEventPropertyValue CreatePropertyValue(object value, Destructuring destructur
return compilerGeneratedResult;

return new ScalarValue(value.ToString());
}
}

bool TryConvertEnumerable(object value, Destructuring destructuring, Type valueType, out LogEventPropertyValue result)
{
Expand Down Expand Up @@ -364,11 +364,10 @@ internal static bool IsCompilerGeneratedType(Type type)
var typeInfo = type.GetTypeInfo();
var typeName = type.Name;

//C# Anonymous types always start with "<>" and VB's start with "VB$"
// C# Anonymous types always start with "<>" and VB's start with "VB$"
return typeInfo.IsGenericType && typeInfo.IsSealed && typeInfo.IsNotPublic && type.Namespace == null
&& (typeName[0] == '<'
|| (typeName.Length > 2 && typeName[0] == 'V' && typeName[1] == 'B' && typeName[2] == '$'));
}
}
}

2 changes: 1 addition & 1 deletion src/Serilog/Configuration/LoggerAuditSinkConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,6 @@ internal LoggerAuditSinkConfiguration(LoggerConfiguration loggerConfiguration, A
LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum)
{
return _sinkConfiguration.Logger(logger, restrictedToMinimumLevel);
}
}
}
}
28 changes: 9 additions & 19 deletions src/Serilog/Configuration/LoggerDestructuringConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,12 @@ public class LoggerDestructuringConfiguration
Action<int> setMaximumStringLength,
Action<int> setMaximumCollectionCount)
{
if (loggerConfiguration == null) throw new ArgumentNullException(nameof(loggerConfiguration));
if (addScalar == null) throw new ArgumentNullException(nameof(addScalar));
if (addPolicy == null) throw new ArgumentNullException(nameof(addPolicy));
if (setMaximumDepth == null) throw new ArgumentNullException(nameof(setMaximumDepth));
if (setMaximumStringLength == null) throw new ArgumentNullException(nameof(setMaximumStringLength));
if (setMaximumCollectionCount == null) throw new ArgumentNullException(nameof(setMaximumCollectionCount));
_loggerConfiguration = loggerConfiguration;
_addScalar = addScalar;
_addPolicy = addPolicy;
_setMaximumDepth = setMaximumDepth;
_setMaximumStringLength = setMaximumStringLength;
_setMaximumCollectionCount = setMaximumCollectionCount;
_loggerConfiguration = loggerConfiguration ?? throw new ArgumentNullException(nameof(loggerConfiguration));
_addScalar = addScalar ?? throw new ArgumentNullException(nameof(addScalar));
_addPolicy = addPolicy ?? throw new ArgumentNullException(nameof(addPolicy));
_setMaximumDepth = setMaximumDepth ?? throw new ArgumentNullException(nameof(setMaximumDepth));
_setMaximumStringLength = setMaximumStringLength ?? throw new ArgumentNullException(nameof(setMaximumStringLength));
_setMaximumCollectionCount = setMaximumCollectionCount ?? throw new ArgumentNullException(nameof(setMaximumCollectionCount));
}

/// <summary>
Expand All @@ -72,10 +66,7 @@ public LoggerConfiguration AsScalar(Type scalarType)
/// </summary>
/// <typeparam name="TScalar">Type to treat as scalar.</typeparam>
/// <returns>Configuration object allowing method chaining.</returns>
public LoggerConfiguration AsScalar<TScalar>()
{
return AsScalar(typeof(TScalar));
}
public LoggerConfiguration AsScalar<TScalar>() => AsScalar(typeof(TScalar));

/// <summary>
/// When destructuring objects, transform instances with the provided policies.
Expand Down Expand Up @@ -162,7 +153,7 @@ public LoggerConfiguration ToMaximumDepth(int maximumDestructuringDepth)

/// <summary>
/// When destructuring objects, string values can be restricted to specified length
/// thus avoiding bloating payload. Limit is applied to each value separately,
/// thus avoiding bloating payload. Limit is applied to each value separately,
/// sum of length of strings can exceed limit.
/// </summary>
/// <param name="maximumStringLength">The maximum string length.</param>
Expand All @@ -177,7 +168,7 @@ public LoggerConfiguration ToMaximumStringLength(int maximumStringLength)

/// <summary>
/// When destructuring objects, collections be restricted to specified count
/// thus avoiding bloating payload. Limit is applied to each collection separately,
/// thus avoiding bloating payload. Limit is applied to each collection separately,
/// sum of length of collection can exceed limit.
/// Applies limit to all <see cref="IEnumerable"/> including dictionaries.
/// </summary>
Expand All @@ -191,4 +182,3 @@ public LoggerConfiguration ToMaximumCollectionCount(int maximumCollectionCount)
}
}
}

13 changes: 4 additions & 9 deletions src/Serilog/Configuration/LoggerEnrichmentConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@ public class LoggerEnrichmentConfiguration
LoggerConfiguration loggerConfiguration,
Action<ILogEventEnricher> addEnricher)
{
if (loggerConfiguration == null) throw new ArgumentNullException(nameof(loggerConfiguration));
if (addEnricher == null) throw new ArgumentNullException(nameof(addEnricher));
_loggerConfiguration = loggerConfiguration;
_addEnricher = addEnricher;
_loggerConfiguration = loggerConfiguration ?? throw new ArgumentNullException(nameof(loggerConfiguration));
_addEnricher = addEnricher ?? throw new ArgumentNullException(nameof(addEnricher));
}

/// <summary>
Expand Down Expand Up @@ -74,7 +72,7 @@ public LoggerConfiguration With<TEnricher>()
/// </summary>
/// <param name="name">The name of the property to add.</param>
/// <param name="value">The property value to add.</param>
/// <param name="destructureObjects">If true, objects of unknown type will be logged as structures; otherwise they will be converted using <see cref="Object.ToString"/>.</param>
/// <param name="destructureObjects">If true, objects of unknown type will be logged as structures; otherwise they will be converted using <see cref="object.ToString"/>.</param>
/// <returns>Configuration object allowing method chaining.</returns>
public LoggerConfiguration WithProperty(string name, object value, bool destructureObjects = false)
{
Expand All @@ -86,9 +84,6 @@ public LoggerConfiguration WithProperty(string name, object value, bool destruct
/// </summary>
/// <returns>Configuration object allowing method chaining.</returns>
/// <exception cref="ArgumentNullException"></exception>
public LoggerConfiguration FromLogContext()
{
return With<LogContextEnricher>();
}
public LoggerConfiguration FromLogContext() => With<LogContextEnricher>();
}
}
8 changes: 2 additions & 6 deletions src/Serilog/Configuration/LoggerFilterConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,10 @@ public class LoggerFilterConfiguration
LoggerConfiguration loggerConfiguration,
Action<ILogEventFilter> addFilter)
{
if (loggerConfiguration == null) throw new ArgumentNullException(nameof(loggerConfiguration));
if (addFilter == null) throw new ArgumentNullException(nameof(addFilter));
_loggerConfiguration = loggerConfiguration;
_addFilter = addFilter;
_loggerConfiguration = loggerConfiguration ?? throw new ArgumentNullException(nameof(loggerConfiguration));
_addFilter = addFilter ?? throw new ArgumentNullException(nameof(addFilter));
}


/// <summary>
/// Filter out log events from the stream based on the provided filter.
/// </summary>
Expand Down Expand Up @@ -89,4 +86,3 @@ public LoggerConfiguration ByIncludingOnly(Func<LogEvent, bool> inclusionPredica
}
}
}

0 comments on commit fa506c8

Please sign in to comment.