2017-07-20 11:21:28 +02:00
|
|
|
|
using System;
|
2015-01-09 10:51:15 +11:00
|
|
|
|
|
|
|
|
|
|
namespace Umbraco.Core.Logging
|
|
|
|
|
|
{
|
2016-09-11 19:57:33 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Implements <see cref="ILogger"/> on top of <see cref="System.Diagnostics"/>.
|
|
|
|
|
|
/// </summary>
|
2016-09-23 16:42:42 +02:00
|
|
|
|
public class DebugDiagnosticsLogger : ILogger
|
2015-01-09 10:51:15 +11:00
|
|
|
|
{
|
2019-11-06 10:43:33 +01:00
|
|
|
|
private readonly IMessageTemplates _messageTemplates;
|
|
|
|
|
|
|
|
|
|
|
|
public DebugDiagnosticsLogger(IMessageTemplates messageTemplates)
|
|
|
|
|
|
{
|
|
|
|
|
|
_messageTemplates = messageTemplates;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-08-30 19:08:55 +02:00
|
|
|
|
public bool IsEnabled(Type reporting, LogLevel level)
|
|
|
|
|
|
=> true;
|
|
|
|
|
|
|
2018-08-28 15:24:45 +10:00
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
|
public void Fatal(Type reporting, Exception exception, string message)
|
|
|
|
|
|
{
|
|
|
|
|
|
System.Diagnostics.Debug.WriteLine(message + Environment.NewLine + exception, reporting.FullName);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
|
public void Fatal(Type reporting, Exception exception)
|
|
|
|
|
|
{
|
|
|
|
|
|
System.Diagnostics.Debug.WriteLine(Environment.NewLine + exception, reporting.FullName);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
|
public void Fatal(Type reporting, string message)
|
|
|
|
|
|
{
|
|
|
|
|
|
System.Diagnostics.Debug.WriteLine(message);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
2018-08-30 19:08:55 +02:00
|
|
|
|
public void Fatal(Type reporting, Exception exception, string messageTemplate, params object[] propertyValues)
|
2018-08-28 15:24:45 +10:00
|
|
|
|
{
|
2019-11-06 10:43:33 +01:00
|
|
|
|
System.Diagnostics.Debug.WriteLine(_messageTemplates.Render(messageTemplate, propertyValues) + Environment.NewLine + exception, reporting.FullName);
|
2018-08-28 15:24:45 +10:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
2018-08-30 19:08:55 +02:00
|
|
|
|
public void Fatal(Type reporting, string messageTemplate, params object[] propertyValues)
|
2018-08-28 15:24:45 +10:00
|
|
|
|
{
|
2018-08-30 19:08:55 +02:00
|
|
|
|
System.Diagnostics.Debug.WriteLine(messageTemplate, propertyValues);
|
2018-08-28 15:24:45 +10:00
|
|
|
|
}
|
|
|
|
|
|
|
2016-09-11 19:57:33 +02:00
|
|
|
|
/// <inheritdoc/>
|
2018-08-17 15:41:58 +01:00
|
|
|
|
public void Error(Type reporting, Exception exception, string message)
|
2015-01-09 10:51:15 +11:00
|
|
|
|
{
|
2016-09-11 19:57:33 +02:00
|
|
|
|
System.Diagnostics.Debug.WriteLine(message + Environment.NewLine + exception, reporting.FullName);
|
2015-01-09 10:51:15 +11:00
|
|
|
|
}
|
|
|
|
|
|
|
2018-08-23 12:14:07 +01:00
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
|
public void Error(Type reporting, Exception exception)
|
|
|
|
|
|
{
|
|
|
|
|
|
System.Diagnostics.Debug.WriteLine(Environment.NewLine + exception, reporting.FullName);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-08-23 14:43:38 +01:00
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
|
public void Error(Type reporting, string message)
|
|
|
|
|
|
{
|
|
|
|
|
|
System.Diagnostics.Debug.WriteLine(message);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-08-14 13:29:38 +01:00
|
|
|
|
/// <inheritdoc/>
|
2018-08-30 19:08:55 +02:00
|
|
|
|
public void Error(Type reporting, Exception exception, string messageTemplate, params object[] propertyValues)
|
2018-08-14 13:29:38 +01:00
|
|
|
|
{
|
2019-11-06 10:43:33 +01:00
|
|
|
|
System.Diagnostics.Debug.WriteLine(_messageTemplates.Render(messageTemplate, propertyValues) + Environment.NewLine + exception, reporting.FullName);
|
2018-08-14 13:29:38 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2018-08-23 14:43:38 +01:00
|
|
|
|
/// <inheritdoc/>
|
2018-08-30 19:08:55 +02:00
|
|
|
|
public void Error(Type reporting, string messageTemplate, params object[] propertyValues)
|
2018-08-23 14:43:38 +01:00
|
|
|
|
{
|
2018-08-30 19:08:55 +02:00
|
|
|
|
System.Diagnostics.Debug.WriteLine(messageTemplate, propertyValues);
|
2018-08-23 14:43:38 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2016-09-11 19:57:33 +02:00
|
|
|
|
/// <inheritdoc/>
|
2018-08-30 19:08:55 +02:00
|
|
|
|
public void Warn(Type reporting, string message)
|
2015-01-09 10:51:15 +11:00
|
|
|
|
{
|
2018-08-30 19:08:55 +02:00
|
|
|
|
System.Diagnostics.Debug.WriteLine(message, reporting.FullName);
|
2015-01-09 10:51:15 +11:00
|
|
|
|
}
|
2018-08-30 19:08:55 +02:00
|
|
|
|
|
2016-09-11 19:57:33 +02:00
|
|
|
|
/// <inheritdoc/>
|
2018-08-30 19:08:55 +02:00
|
|
|
|
public void Warn(Type reporting, string message, params object[] propertyValues)
|
2015-01-09 10:51:15 +11:00
|
|
|
|
{
|
2019-11-06 10:43:33 +01:00
|
|
|
|
System.Diagnostics.Debug.WriteLine(_messageTemplates.Render(message, propertyValues), reporting.FullName);
|
2015-01-09 10:51:15 +11:00
|
|
|
|
}
|
|
|
|
|
|
|
2016-09-11 19:57:33 +02:00
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
|
public void Warn(Type reporting, Exception exception, string message)
|
2015-01-09 10:51:15 +11:00
|
|
|
|
{
|
2016-09-11 19:57:33 +02:00
|
|
|
|
System.Diagnostics.Debug.WriteLine(message + Environment.NewLine + exception, reporting.FullName);
|
2015-01-09 10:51:15 +11:00
|
|
|
|
}
|
|
|
|
|
|
|
2016-09-11 19:57:33 +02:00
|
|
|
|
/// <inheritdoc/>
|
2018-08-30 19:08:55 +02:00
|
|
|
|
public void Warn(Type reporting, Exception exception, string message, params object[] propertyValues)
|
2016-09-11 19:57:33 +02:00
|
|
|
|
{
|
2019-11-06 10:43:33 +01:00
|
|
|
|
System.Diagnostics.Debug.WriteLine(_messageTemplates.Render(message + Environment.NewLine + exception, propertyValues), reporting.FullName);
|
2016-09-11 19:57:33 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
|
public void Info(Type reporting, string message)
|
|
|
|
|
|
{
|
|
|
|
|
|
System.Diagnostics.Debug.WriteLine(message, reporting.FullName);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
2018-08-30 19:08:55 +02:00
|
|
|
|
public void Info(Type reporting, string messageTemplate, params object[] propertyValues)
|
2016-09-11 19:57:33 +02:00
|
|
|
|
{
|
2019-11-06 10:43:33 +01:00
|
|
|
|
System.Diagnostics.Debug.WriteLine(_messageTemplates.Render(messageTemplate, propertyValues), reporting.FullName);
|
2016-09-11 19:57:33 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
|
public void Debug(Type reporting, string message)
|
|
|
|
|
|
{
|
|
|
|
|
|
System.Diagnostics.Debug.WriteLine(message, reporting.FullName);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
2018-08-30 19:08:55 +02:00
|
|
|
|
public void Debug(Type reporting, string messageTemplate, params object[] propertyValues)
|
2016-09-11 19:57:33 +02:00
|
|
|
|
{
|
2019-11-06 10:43:33 +01:00
|
|
|
|
System.Diagnostics.Debug.WriteLine(_messageTemplates.Render(messageTemplate, propertyValues), reporting.FullName);
|
2016-09-11 19:57:33 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
2018-08-15 16:39:35 +01:00
|
|
|
|
public void Verbose(Type reporting, string message)
|
|
|
|
|
|
{
|
|
|
|
|
|
System.Diagnostics.Debug.WriteLine(message, reporting.FullName);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
2018-08-30 19:08:55 +02:00
|
|
|
|
public void Verbose(Type reporting, string messageTemplate, params object[] propertyValues)
|
2016-09-11 19:57:33 +02:00
|
|
|
|
{
|
2019-11-06 10:43:33 +01:00
|
|
|
|
System.Diagnostics.Debug.WriteLine(_messageTemplates.Render(messageTemplate, propertyValues), reporting.FullName);
|
2018-08-30 19:08:55 +02:00
|
|
|
|
}
|
2015-01-09 10:51:15 +11:00
|
|
|
|
}
|
2017-07-20 11:21:28 +02:00
|
|
|
|
}
|