You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
946 B
33 lines
946 B
// Author: Simon Gockner
|
|
// Created: 2020-02-08
|
|
// Copyright(c) 2020 SimonG. All Rights Reserved.
|
|
|
|
using System;
|
|
using System.Threading.Tasks;
|
|
using GBase.Logging.Interfaces;
|
|
|
|
namespace GBase.Logging
|
|
{
|
|
/// <summary>
|
|
/// An <see cref="ILogger"/> that writes log messages to the <see cref="Console"/>
|
|
/// </summary>
|
|
public class ConsoleLogger : ILogger
|
|
{
|
|
/// <summary>
|
|
/// Write the given <see cref="string"/> to the <see cref="Console"/>
|
|
/// </summary>
|
|
/// <param name="message">The <see cref="ILogMessage"/></param>
|
|
public async Task Write(ILogMessage message)
|
|
{
|
|
await Task.Run(() => Console.Write(message.ToString()));
|
|
}
|
|
|
|
/// <summary>
|
|
/// <see cref="DisposeAsync"/> the <see cref="ConsoleLogger"/>
|
|
/// </summary>
|
|
public async ValueTask DisposeAsync()
|
|
{
|
|
await Task.Run(Console.Clear);
|
|
}
|
|
}
|
|
} |