Log stack trace when logging exceptions #198

This commit is contained in:
John Luo 2016-07-13 13:58:39 -07:00
parent 5541fc28bf
commit b132b69cb3
1 changed files with 5 additions and 10 deletions

View File

@ -51,32 +51,27 @@ namespace Microsoft.AspNetCore.Server.WebListener
} }
} }
internal static void LogDebug(ILogger logger, string data) internal static void LogDebug(ILogger logger, string location, Exception exception)
{ {
if (logger == null) if (logger == null)
{ {
Debug.WriteLine(data); Console.WriteLine(location + Environment.NewLine + exception.ToString());
} }
else else
{ {
logger.LogDebug(data); logger.LogDebug(0, exception, location);
} }
} }
internal static void LogDebug(ILogger logger, string location, Exception exception)
{
LogDebug(logger, location + "; " + exception.ToString());
}
internal static void LogException(ILogger logger, string location, Exception exception) internal static void LogException(ILogger logger, string location, Exception exception)
{ {
if (logger == null) if (logger == null)
{ {
Debug.WriteLine(exception); Debug.WriteLine(location + Environment.NewLine + exception.ToString());
} }
else else
{ {
logger.LogError(location, exception); logger.LogError(0, exception, location);
} }
} }