OneComputeWpfClient\Services\TraceLogger.cs
using System.Diagnostics;
using System.Threading.Tasks;
using DNV.One.Compute.Core.ServiceContracts;
namespace OneComputeWpfClient.Services
{
/// <summary>
/// The logger.
/// </summary>
public class TraceLogger : ILogger
{
/// <summary>
/// Logs the error.
/// </summary>
/// <param name="source">The source.</param>
/// <param name="message">The message.</param>
public void LogError(string source, string message)
{
Trace.WriteLine($"Error: {source}-{message}");
}
/// <summary>
/// Log errors.
/// </summary>
/// <param name="source">
/// The source.
/// </param>
/// <param name="message">
/// The message.
/// </param>
/// <returns>
/// The <see cref="Task"/>.
/// </returns>
public Task LogErrorAsync(string source, string message)
{
this.LogError(source, message);
return Task.FromResult<object>(null);
}
/// <summary>
/// Logs the information.
/// </summary>
/// <param name="source">The source.</param>
/// <param name="message">The message.</param>
public void LogInformation(string source, string message)
{
Trace.WriteLine($"Info: {source}-{message}");
}
/// <summary>
/// Log information.
/// </summary>
/// <param name="source">
/// The source.
/// </param>
/// <param name="message">
/// The message.
/// </param>
/// <returns>
/// The <see cref="Task"/>.
/// </returns>
public Task LogInformationAsync(string source, string message)
{
this.LogInformation(source, message);
return Task.FromResult<object>(null);
}
/// <summary>
/// Logs the warning.
/// </summary>
/// <param name="source">The source.</param>
/// <param name="message">The message.</param>
public void LogWarning(string source, string message)
{
Trace.WriteLine($"Warning: {source}-{message}");
}
/// <summary>
/// Log warnings.
/// </summary>
/// <param name="source">
/// The source.
/// </param>
/// <param name="message">
/// The message.
/// </param>
/// <returns>
/// The <see cref="Task"/>.
/// </returns>
public Task LogWarningAsync(string source, string message)
{
this.LogWarning(source, message);
return Task.FromResult<object>(null);
}
}
}