diff --git a/README.md b/README.md
index bdc3f706..b4245025 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
Logging
=======
-Contains common logging abstractions for ASP.NET vNext. Refer to the [wiki](https://github.com/aspnet/Logging/wiki) for more information
+Contains common logging abstractions for ASP.NET 5. Refer to the [wiki](https://github.com/aspnet/Logging/wiki) for more information
-This project is part of ASP.NET vNext. You can find samples, documentation and getting started instructions for ASP.NET vNext at the [Home](https://github.com/aspnet/home) repo.
+This project is part of ASP.NET 5. You can find samples, documentation and getting started instructions for ASP.NET 5 at the [Home](https://github.com/aspnet/home) repo.
diff --git a/build.cmd b/build.cmd
index 86ca5bbb..220a1ff5 100644
--- a/build.cmd
+++ b/build.cmd
@@ -19,10 +19,10 @@ IF EXIST packages\KoreBuild goto run
.nuget\NuGet.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre
.nuget\NuGet.exe install Sake -version 0.2 -o packages -ExcludeVersion
-IF "%SKIP_KRE_INSTALL%"=="1" goto run
-CALL packages\KoreBuild\build\kvm upgrade -runtime CLR -x86
-CALL packages\KoreBuild\build\kvm install default -runtime CoreCLR -x86
+IF "%SKIP_DOTNET_INSTALL%"=="1" goto run
+CALL packages\KoreBuild\build\dotnetsdk upgrade -runtime CLR -x86
+CALL packages\KoreBuild\build\dotnetsdk install default -runtime CoreCLR -x86
:run
-CALL packages\KoreBuild\build\kvm use default -runtime CLR -x86
+CALL packages\KoreBuild\build\dotnetsdk use default -runtime CLR -x86
packages\Sake\tools\Sake.exe -I packages\KoreBuild\build -f makefile.shade %*
diff --git a/build.sh b/build.sh
index c7873ef5..350d7e38 100755
--- a/build.sh
+++ b/build.sh
@@ -28,11 +28,11 @@ if test ! -d packages/KoreBuild; then
fi
if ! type k > /dev/null 2>&1; then
- source packages/KoreBuild/build/kvm.sh
+ source packages/KoreBuild/build/dotnetsdk.sh
fi
if ! type k > /dev/null 2>&1; then
- kvm upgrade
+ dotnetsdk upgrade
fi
mono packages/Sake/tools/Sake.exe -I packages/KoreBuild/build -f makefile.shade "$@"
diff --git a/src/Microsoft.Framework.Logging.Console/ConsoleLogger.cs b/src/Microsoft.Framework.Logging.Console/ConsoleLogger.cs
index 3b175ef6..09761cad 100644
--- a/src/Microsoft.Framework.Logging.Console/ConsoleLogger.cs
+++ b/src/Microsoft.Framework.Logging.Console/ConsoleLogger.cs
@@ -52,14 +52,7 @@ public void Write(LogLevel logLevel, int eventId, object state, Exception except
}
else
{
- if (state != null)
- {
- message += state;
- }
- if (exception != null)
- {
- message += Environment.NewLine + exception;
- }
+ message = LogFormatter.Formatter(state, exception);
}
if (string.IsNullOrEmpty(message))
{
diff --git a/src/Microsoft.Framework.Logging.Interfaces/ILogger.cs b/src/Microsoft.Framework.Logging.Interfaces/ILogger.cs
index 2681d20d..bca053a0 100644
--- a/src/Microsoft.Framework.Logging.Interfaces/ILogger.cs
+++ b/src/Microsoft.Framework.Logging.Interfaces/ILogger.cs
@@ -14,7 +14,7 @@ namespace Microsoft.Framework.Logging
public interface ILogger
{
///
- /// Aggregates most logging patterns to a single method. This must be compatible with the Func representation in the OWIN environment.
+ /// Aggregates most logging patterns to a single method.
///
///
///
diff --git a/src/Microsoft.Framework.Logging.NLog/NLogLoggerProvider.cs b/src/Microsoft.Framework.Logging.NLog/NLogLoggerProvider.cs
index 7844ee6c..83c4d413 100644
--- a/src/Microsoft.Framework.Logging.NLog/NLogLoggerProvider.cs
+++ b/src/Microsoft.Framework.Logging.NLog/NLogLoggerProvider.cs
@@ -44,14 +44,7 @@ public void Write(
}
else
{
- if (state != null)
- {
- message += state;
- }
- if (exception != null)
- {
- message += Environment.NewLine + exception;
- }
+ LogFormatter.Formatter(state, exception);
}
if (!string.IsNullOrEmpty(message))
{
diff --git a/src/Microsoft.Framework.Logging.NLog/project.json b/src/Microsoft.Framework.Logging.NLog/project.json
index 0342ac08..507247fd 100644
--- a/src/Microsoft.Framework.Logging.NLog/project.json
+++ b/src/Microsoft.Framework.Logging.NLog/project.json
@@ -1,18 +1,11 @@
{
"version": "1.0.0-*",
"dependencies": {
+ "Microsoft.Framework.Logging": "1.0.0-*",
"NLog": "3.1.0"
},
"frameworks": {
- "net45": {
- "dependencies": {
- "Microsoft.Framework.Logging.Interfaces": "1.0.0-*"
- }
- },
- "aspnet50": {
- "dependencies": {
- "Microsoft.Framework.Logging.Interfaces": { "version": "1.0.0-*", "type": "build" }
- }
- }
+ "net45": { },
+ "aspnet50": { }
}
}
\ No newline at end of file
diff --git a/src/Microsoft.Framework.Logging.Serilog/SerilogLogger.cs b/src/Microsoft.Framework.Logging.Serilog/SerilogLogger.cs
index 2c6be8df..1d1eadb6 100644
--- a/src/Microsoft.Framework.Logging.Serilog/SerilogLogger.cs
+++ b/src/Microsoft.Framework.Logging.Serilog/SerilogLogger.cs
@@ -53,14 +53,7 @@ public void Write(LogLevel logLevel, int eventId, object state, Exception except
}
else
{
- if (state != null)
- {
- message += state;
- }
- if (exception != null)
- {
- message += Environment.NewLine + exception;
- }
+ message = LogFormatter.Formatter(state, exception);
}
if (string.IsNullOrEmpty(message))
{
diff --git a/src/Microsoft.Framework.Logging/DiagnosticsLoggerProvider.cs b/src/Microsoft.Framework.Logging/DiagnosticsLoggerProvider.cs
index ea281fc3..8b55c069 100644
--- a/src/Microsoft.Framework.Logging/DiagnosticsLoggerProvider.cs
+++ b/src/Microsoft.Framework.Logging/DiagnosticsLoggerProvider.cs
@@ -23,7 +23,7 @@ public class DiagnosticsLoggerProvider : ILoggerProvider
/// Initializes a new instance of the class.
///
///
- /// Creates a factory named "Microsoft.Owin".
+ /// Creates a factory named "Microsoft.AspNet".
///
public DiagnosticsLoggerProvider()
{
diff --git a/src/Microsoft.Framework.Logging/LogFormatter.cs b/src/Microsoft.Framework.Logging/LogFormatter.cs
new file mode 100644
index 00000000..7485fe98
--- /dev/null
+++ b/src/Microsoft.Framework.Logging/LogFormatter.cs
@@ -0,0 +1,107 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using JetBrains.Annotations;
+
+namespace Microsoft.Framework.Logging
+{
+ ///
+ /// Formatters for common logging scenarios.
+ ///
+ public static class LogFormatter
+ {
+ private const string space = " ";
+
+ ///
+ /// Formats a message from the given state and exception, in the form
+ /// "state
+ /// exception".
+ /// If state is an ,
+ /// is used to format the message, otherwise the state's ToString() is used.
+ ///
+ public static string Formatter(object state, Exception e)
+ {
+ var result = string.Empty;
+ if (state != null)
+ {
+ var structure = state as ILoggerStructure;
+ if (structure != null)
+ {
+ result += FormatStructure(structure);
+ }
+ else
+ {
+ result += state;
+ }
+ }
+ if (e != null)
+ {
+ result += Environment.NewLine + e;
+ }
+
+ return result;
+ }
+
+ ///
+ /// Formats an .
+ ///
+ /// The to format.
+ /// A string representation of the given .
+ public static string FormatStructure([NotNull] ILoggerStructure structure)
+ {
+ var builder = new StringBuilder();
+ FormatStructure(structure, builder);
+ return builder.ToString();
+ }
+
+ ///
+ /// Formats an .
+ ///
+ /// The to format.
+ /// The to append to.
+ private static void FormatStructure([NotNull] ILoggerStructure structure, [NotNull] StringBuilder builder)
+ {
+ var values = structure.GetValues();
+ if (values == null)
+ {
+ return;
+ }
+
+ foreach (var kvp in values)
+ {
+ IEnumerable structureEnumerable;
+ ILoggerStructure loggerStructure;
+ builder.Append(kvp.Key);
+ builder.Append(": ");
+ if ((structureEnumerable = kvp.Value as IEnumerable) != null)
+ {
+ var valArray = structureEnumerable.ToArray();
+ for (int j = 0; j < valArray.Length - 1; j++)
+ {
+ FormatStructure(valArray[j], builder);
+ builder.Append(", ");
+ }
+ if (valArray.Length > 0)
+ {
+ FormatStructure(valArray[valArray.Length - 1], builder);
+ }
+ }
+ else if ((loggerStructure = kvp.Value as ILoggerStructure) != null)
+ {
+ FormatStructure(loggerStructure, builder);
+ }
+ else
+ {
+ builder.Append(kvp.Value);
+ }
+ builder.Append(space);
+ }
+ // get rid of the extra whitespace
+ if (builder.Length > 0)
+ {
+ builder.Length -= space.Length;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Microsoft.Framework.Logging/LoggerExtensions.cs b/src/Microsoft.Framework.Logging/LoggerExtensions.cs
index b116897a..fad61b32 100644
--- a/src/Microsoft.Framework.Logging/LoggerExtensions.cs
+++ b/src/Microsoft.Framework.Logging/LoggerExtensions.cs
@@ -48,7 +48,7 @@ public static void WriteVerbose([NotNull] this ILogger logger, int eventId, stri
/// The to write to.
/// Format string of the log message.
/// An object array that contains zero or more objects to format.
- public static void WriteVerbose([NotNull] this ILogger logger, string format, params string[] args)
+ public static void WriteVerbose([NotNull] this ILogger logger, string format, params object[] args)
{
logger.Write(LogLevel.Verbose, 0,
string.Format(CultureInfo.InvariantCulture, format, args), null, TheMessage);
@@ -61,7 +61,7 @@ public static void WriteVerbose([NotNull] this ILogger logger, string format, pa
/// The event id associated with the log.
/// Format string of the log message.
/// An object array that contains zero or more objects to format.
- public static void WriteVerbose([NotNull] this ILogger logger, int eventId, string format, params string[] args)
+ public static void WriteVerbose([NotNull] this ILogger logger, int eventId, string format, params object[] args)
{
logger.Write(LogLevel.Verbose, eventId,
string.Format(CultureInfo.InvariantCulture, format, args), null, TheMessage);
@@ -126,7 +126,7 @@ public static void WriteInformation([NotNull] this ILogger logger, int eventId,
/// The to write to.
/// Format string of the log message.
/// An object array that contains zero or more objects to format.
- public static void WriteInformation([NotNull] this ILogger logger, string format, params string[] args)
+ public static void WriteInformation([NotNull] this ILogger logger, string format, params object[] args)
{
logger.Write(LogLevel.Information, 0,
string.Format(CultureInfo.InvariantCulture, format, args), null, TheMessage);
@@ -139,7 +139,7 @@ public static void WriteInformation([NotNull] this ILogger logger, string format
/// The event id associated with the log.
/// Format string of the log message.
/// An object array that contains zero or more objects to format.
- public static void WriteInformation([NotNull] this ILogger logger, int eventId, string format, params string[] args)
+ public static void WriteInformation([NotNull] this ILogger logger, int eventId, string format, params object[] args)
{
logger.Write(LogLevel.Information, eventId,
string.Format(CultureInfo.InvariantCulture, format, args), null, TheMessage);
@@ -204,7 +204,7 @@ public static void WriteWarning([NotNull] this ILogger logger, int eventId, stri
/// The to write to.
/// Format string of the log message.
/// An object array that contains zero or more objects to format.
- public static void WriteWarning([NotNull] this ILogger logger, string format, params string[] args)
+ public static void WriteWarning([NotNull] this ILogger logger, string format, params object[] args)
{
logger.Write(LogLevel.Warning, 0,
string.Format(CultureInfo.InvariantCulture, format, args), null, TheMessage);
@@ -217,7 +217,7 @@ public static void WriteWarning([NotNull] this ILogger logger, string format, pa
/// The event id associated with the log.
/// Format string of the log message.
/// An object array that contains zero or more objects to format.
- public static void WriteWarning([NotNull] this ILogger logger, int eventId, string format, params string[] args)
+ public static void WriteWarning([NotNull] this ILogger logger, int eventId, string format, params object[] args)
{
logger.Write(LogLevel.Warning, eventId,
string.Format(CultureInfo.InvariantCulture, format, args), null, TheMessage);
@@ -305,7 +305,7 @@ public static void WriteError([NotNull] this ILogger logger, int eventId, string
/// The to write to.
/// Format string of the log message.
/// An object array that contains zero or more objects to format.
- public static void WriteError([NotNull] this ILogger logger, string format, params string[] args)
+ public static void WriteError([NotNull] this ILogger logger, string format, params object[] args)
{
logger.Write(LogLevel.Error, 0,
string.Format(CultureInfo.InvariantCulture, format, args), null, TheMessage);
@@ -318,7 +318,7 @@ public static void WriteError([NotNull] this ILogger logger, string format, para
/// The event id associated with the log.
/// Format string of the log message.
/// An object array that contains zero or more objects to format.
- public static void WriteError([NotNull] this ILogger logger, int eventId, string format, params string[] args)
+ public static void WriteError([NotNull] this ILogger logger, int eventId, string format, params object[] args)
{
logger.Write(LogLevel.Error, eventId,
string.Format(CultureInfo.InvariantCulture, format, args), null, TheMessage);
@@ -406,7 +406,7 @@ public static void WriteCritical([NotNull] this ILogger logger, int eventId, str
/// The to write to.
/// Format string of the log message.
/// An object array that contains zero or more objects to format.
- public static void WriteCritical([NotNull] this ILogger logger, string format, params string[] args)
+ public static void WriteCritical([NotNull] this ILogger logger, string format, params object[] args)
{
logger.Write(LogLevel.Critical, 0,
string.Format(CultureInfo.InvariantCulture, format, args), null, TheMessage);
@@ -419,7 +419,7 @@ public static void WriteCritical([NotNull] this ILogger logger, string format, p
/// The event id associated with the log.
/// Format string of the log message.
/// An object array that contains zero or more objects to format.
- public static void WriteCritical([NotNull] this ILogger logger, int eventId, string format, params string[] args)
+ public static void WriteCritical([NotNull] this ILogger logger, int eventId, string format, params object[] args)
{
logger.Write(LogLevel.Critical, eventId,
string.Format(CultureInfo.InvariantCulture, format, args), null, TheMessage);
diff --git a/src/Microsoft.Framework.Logging/project.json b/src/Microsoft.Framework.Logging/project.json
index 0bf825e0..436be3fd 100644
--- a/src/Microsoft.Framework.Logging/project.json
+++ b/src/Microsoft.Framework.Logging/project.json
@@ -21,7 +21,7 @@
"System.Diagnostics.TraceSource": "4.0.0-beta-*",
"System.Globalization": "4.0.10-beta-*",
"System.Linq": "4.0.0-beta-*",
- "System.Threading": "4.0.0-beta-*",
+ "System.Threading": "4.0.10-beta-*",
"Microsoft.Framework.Logging.Interfaces": { "version": "1.0.0-*", "type": "build" }
}
},
diff --git a/test/Microsoft.Framework.Logging.Test/project.json b/test/Microsoft.Framework.Logging.Test/project.json
index 7cfa54d4..3a97fd0a 100644
--- a/test/Microsoft.Framework.Logging.Test/project.json
+++ b/test/Microsoft.Framework.Logging.Test/project.json
@@ -2,11 +2,11 @@
"dependencies": {
"Microsoft.Framework.Logging.Console": "1.0.0-*",
"Microsoft.Framework.Logging.Serilog": "1.0.0-*",
- "Xunit.KRunner": "1.0.0-*"
+ "xunit.runner.kre": "1.0.0-*"
},
"commands": {
- "run": "Xunit.KRunner",
- "test": "Xunit.KRunner"
+ "run": "xunit.runner.kre",
+ "test": "xunit.runner.kre"
},
"frameworks": {
"aspnet50": {