Skip to content
This repository was archived by the owner on Dec 13, 2018. It is now read-only.

Commit b4a4f0f

Browse files
committed
bug fix and unit tests for extension methods
1 parent 613bb01 commit b4a4f0f

File tree

3 files changed

+551
-3
lines changed

3 files changed

+551
-3
lines changed

src/Microsoft.Framework.Logging.Console/ConsoleLogger.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ public void Write(LogLevel logLevel, int eventId, object state, Exception except
4141
level: 1,
4242
bullet: false);
4343
message = builder.ToString();
44+
if (exception != null)
45+
{
46+
message += Environment.NewLine + exception;
47+
}
4448
}
4549
else if (formatter != null)
4650
{

src/Microsoft.Framework.Logging/LoggerExtensions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ private static void Write(
486486
ILoggerStructure state,
487487
Exception exception = null)
488488
{
489-
logger.Write(logLevel, 0, state, null, _loggerStructureFormatter);
489+
logger.Write(logLevel, 0, state, exception, _loggerStructureFormatter);
490490
}
491491

492492
private static void WriteWithEvent(
@@ -496,12 +496,12 @@ private static void WriteWithEvent(
496496
ILoggerStructure state,
497497
Exception exception = null)
498498
{
499-
logger.Write(logLevel, eventId, state, null, _loggerStructureFormatter);
499+
logger.Write(logLevel, eventId, state, exception, _loggerStructureFormatter);
500500
}
501501

502502
private static string LoggerStructureFormatter(ILoggerStructure state, Exception exception)
503503
{
504-
return state.Format();
504+
return state.Format() + Environment.NewLine + exception;
505505
}
506506
}
507507
}

0 commit comments

Comments
 (0)