A database based on .net
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.

44 lines
1.3 KiB

// Author: Simon Gockner
// Created: 2020-02-08
// Copyright(c) 2020 SimonG. All Rights Reserved.
using System;
using GBase.Logging.Interfaces;
namespace GBase.Logging
{
/// <summary>
/// Implementation of <see cref="ILogMessage"/>
/// </summary>
public class LogMessage : ILogMessage
{
/// <summary>
/// The <see cref="LogLevels"/> of the <see cref="LogMessage"/>
/// </summary>
public LogLevels LogLevel { get; set; }
/// <summary>
/// The <see cref="Timestamp"/> of the <see cref="LogMessage"/>
/// </summary>
public DateTime Timestamp { get; set; }
/// <summary>
/// The <see cref="ILogComponent"/> of the <see cref="LogMessage"/>
/// </summary>
public ILogComponent Component { get; set; }
/// <summary>
/// The <see cref="Message"/> of the <see cref="LogMessage"/>
/// </summary>
public string Message { get; set; }
/// <summary>
/// Builds the <see cref="LogMessage"/> out of all parts and returns it as a <see cref="string"/>
/// </summary>
/// <returns>The <see cref="LogMessage"/> as a <see cref="string"/></returns>
public override string ToString()
{
return $"{Timestamp:u}: [{Component}] {Message}\n";
}
}
}