diff --git a/global.json b/global.json index 41ee5d1..281c9c5 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "projects": [ "src", "test" ], "sdk": { - "version": "1.0.0-rc1-update1" + "version": "1.0.0-preview1-002702" } } diff --git a/sample/Loggr.Extensions.Logging.Console/Loggr.Extensions.Logging.Console.xproj b/sample/Loggr.Extensions.Logging.Console/Loggr.Extensions.Logging.Console.xproj index 589a7dc..e3d29a5 100644 --- a/sample/Loggr.Extensions.Logging.Console/Loggr.Extensions.Logging.Console.xproj +++ b/sample/Loggr.Extensions.Logging.Console/Loggr.Extensions.Logging.Console.xproj @@ -4,17 +4,15 @@ 14.0 $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - + e88c4a16-6b32-4e31-a23c-4afbcfa0bb5d Loggr.Extensions.Logging.Console - ..\..\artifacts\obj\$(MSBuildProjectName) - ..\..\artifacts\bin\$(MSBuildProjectName)\ + .\obj + .\bin\ - 2.0 - - + + \ No newline at end of file diff --git a/sample/Loggr.Extensions.Logging.Console/Program.cs b/sample/Loggr.Extensions.Logging.Console/Program.cs index 4541254..d69efc0 100644 --- a/sample/Loggr.Extensions.Logging.Console/Program.cs +++ b/sample/Loggr.Extensions.Logging.Console/Program.cs @@ -14,10 +14,10 @@ public static void Main( string[] args ) logger.LogCritical( "This is critical", new Exception( "Critical stuff going down" ) ); logger.LogError( "This is an error", new Exception( "Erroneous stuff all over the place" ) ); logger.LogInformation( "This is information" ); - logger.LogVerbose( "This is verbose" ); + logger.LogTrace( "This is trace" ); logger.LogWarning( "This is a warning" ); - using( logger.BeginScopeImpl( "Main" ) ) + using( logger.BeginScope( "Main" ) ) { logger.LogInformation( "This is information in scope" ); } diff --git a/sample/Loggr.Extensions.Logging.Console/project.json b/sample/Loggr.Extensions.Logging.Console/project.json index 88e1316..4a68b6d 100644 --- a/sample/Loggr.Extensions.Logging.Console/project.json +++ b/sample/Loggr.Extensions.Logging.Console/project.json @@ -1,28 +1,32 @@ { - "version": "1.0.0-rc1-final-*", + "version": "1.0.0-rc2-final", "description": "Loggr.Extensions.Logging console application", "authors": [ "mbishopim3" ], - "tags": [ "" ], - "projectUrl": "https://github.com/imobile3/Loggr.Extensions.Logging", - "licenseUrl": "", - - "compilationOptions": { - "emitEntryPoint": true + "packOptions": { + "tags": [ "loggr" ], + "projectUrl": "https://github.com/imobile3/Loggr.Extensions.Logging", + "iconUrl": "http://static.loggr.net/1/images/nuget/logo.png" }, "dependencies": { - "Loggr.Extensions.Logging": "1.0.0-rc1-final-*" - }, - - "commands": { - "Loggr.Extensions.Logging.Console": "Loggr.Extensions.Logging.Console" + "Loggr.Extensions.Logging": "1.0.0-rc2-final" }, "frameworks": { - "dnx451": { + "netframework451": { + "imports": [ "dnx451" ], "frameworkAssemblies": { "System.Runtime": "" } } + }, + + "runtimeOptions": { + "gcServer": false, + "gcConcurrent": true + }, + + "buildOptions": { + "emitEntryPoint": true } } diff --git a/src/Loggr.Extensions.Logging/Loggr.Extensions.Logging.xproj b/src/Loggr.Extensions.Logging/Loggr.Extensions.Logging.xproj index 0d53041..f73fe3d 100644 --- a/src/Loggr.Extensions.Logging/Loggr.Extensions.Logging.xproj +++ b/src/Loggr.Extensions.Logging/Loggr.Extensions.Logging.xproj @@ -4,12 +4,12 @@ 14.0 $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - + 0af6cb38-184b-4895-985f-35d9c4fac02a Loggr.Extensions.Logging - ..\..\artifacts\obj\$(MSBuildProjectName) - ..\..\artifacts\bin\$(MSBuildProjectName)\ + .\obj + .\bin\ 2.0 @@ -17,5 +17,5 @@ True - + \ No newline at end of file diff --git a/src/Loggr.Extensions.Logging/LoggrLogger.cs b/src/Loggr.Extensions.Logging/LoggrLogger.cs index 737b558..c32ad4e 100644 --- a/src/Loggr.Extensions.Logging/LoggrLogger.cs +++ b/src/Loggr.Extensions.Logging/LoggrLogger.cs @@ -5,7 +5,7 @@ namespace Loggr.Extensions.Logging { public class LoggrLogger : ILogger { - private readonly Func m_filter; + private readonly Func m_filter; private readonly string m_name; private readonly LogClient m_client; private readonly string m_source; @@ -14,7 +14,7 @@ public LoggrLogger( LogClient client, string name, string source ) : this( client, name, source, null ) { } - public LoggrLogger( LogClient client, string name, string source, Func filter ) + public LoggrLogger( LogClient client, string name, string source, Func filter ) { m_client = client; m_name = name; @@ -22,7 +22,7 @@ public LoggrLogger( LogClient client, string name, string source, Func( TState state ) { return null; } @@ -32,12 +32,12 @@ public bool IsEnabled( LogLevel logLevel ) return true; } - public bool IsEnabled( LogLevel logLevel, int eventId ) + public bool IsEnabled( LogLevel logLevel, EventId eventId ) { return m_filter == null || m_filter( m_name, logLevel, eventId ); } - public void Log( LogLevel logLevel, int eventId, object state, Exception exception, Func formatter ) + public void Log( LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter ) { if( !IsEnabled( logLevel, eventId ) ) { @@ -49,22 +49,13 @@ public void Log( LogLevel logLevel, int eventId, object state, Exception excepti return; } - var values = state as ILogValues; - string message; - - if( formatter != null ) - { - message = formatter( state, null ); - } - else if( values != null ) + if( formatter == null ) { - message = LogFormatter.FormatLogValues( values ); - } - else - { - message = LogFormatter.Formatter( state, null ); + throw new ArgumentNullException( nameof( formatter ) ); } + var message = formatter( state, exception ); + if( string.IsNullOrWhiteSpace( message ) ) { message = string.Empty; @@ -108,8 +99,8 @@ private string GetLogLevel( LogLevel logLevel ) { switch( logLevel ) { - case LogLevel.Verbose: - return "verbose"; + case LogLevel.Trace: + return "trace"; case LogLevel.Debug: return "debug"; case LogLevel.Information: diff --git a/src/Loggr.Extensions.Logging/LoggrLoggerFactoryExtensions.cs b/src/Loggr.Extensions.Logging/LoggrLoggerFactoryExtensions.cs index fa7519a..963595a 100644 --- a/src/Loggr.Extensions.Logging/LoggrLoggerFactoryExtensions.cs +++ b/src/Loggr.Extensions.Logging/LoggrLoggerFactoryExtensions.cs @@ -10,7 +10,7 @@ public static ILoggerFactory AddLoggr( this ILoggerFactory factory, string logKe return AddLoggr( factory, LogLevel.Information, logKey, apiKey, source ); } - public static ILoggerFactory AddLoggr( this ILoggerFactory factory, Func filter, string logKey, string apiKey, string source = null ) + public static ILoggerFactory AddLoggr( this ILoggerFactory factory, Func filter, string logKey, string apiKey, string source = null ) { factory.AddProvider( new LoggrLoggerProvider( filter, logKey, apiKey, source ) ); return factory; diff --git a/src/Loggr.Extensions.Logging/LoggrLoggerProvider.cs b/src/Loggr.Extensions.Logging/LoggrLoggerProvider.cs index b469b80..ec7fbff 100644 --- a/src/Loggr.Extensions.Logging/LoggrLoggerProvider.cs +++ b/src/Loggr.Extensions.Logging/LoggrLoggerProvider.cs @@ -5,11 +5,11 @@ namespace Loggr.Extensions.Logging { public class LoggrLoggerProvider : ILoggerProvider { - private readonly Func m_filter; + private readonly Func m_filter; private readonly LogClient m_logClient; private readonly string m_source; - public LoggrLoggerProvider( Func filter, string logKey, string apiKey, string source = null ) + public LoggrLoggerProvider( Func filter, string logKey, string apiKey, string source = null ) { m_filter = filter; m_logClient = new LogClient( logKey, apiKey ); diff --git a/src/Loggr.Extensions.Logging/project.json b/src/Loggr.Extensions.Logging/project.json index 84da318..cb4192d 100644 --- a/src/Loggr.Extensions.Logging/project.json +++ b/src/Loggr.Extensions.Logging/project.json @@ -1,20 +1,28 @@ { - "version": "1.0.1-rc1-final-*", + "version": "1.0.0-rc2-final", "title": "Loggr.Extensions.Logging", "description": "Loggr provider for Microsoft.Extensions.Logging", "authors": [ "mbishopim3" ], - "tags": [ "loggr dnx" ], - "projectUrl": "https://github.com/imobile3/Loggr.Extensions.Logging", - "iconUrl": "http://static.loggr.net/1/images/nuget/logo.png", "copyright": "2015 iMobile3, LLC", + "packOptions": { + "tags": [ "loggr" ], + "projectUrl": "https://github.com/imobile3/Loggr.Extensions.Logging", + "iconUrl": "http://static.loggr.net/1/images/nuget/logo.png" + }, "frameworks": { - "dnx451": { + "netframework451": { + "imports": [ "dnx451" ], "frameworkAssemblies": { "System.Runtime": "" } } }, "dependencies": { - "Microsoft.Extensions.Logging": "1.0.0-rc1-final" + "Microsoft.Extensions.Logging": "1.0.0-rc2-final" + }, + + "runtimeOptions": { + "gcServer": false, + "gcConcurrent": true } }