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.
41 lines
1.3 KiB
41 lines
1.3 KiB
// Author: Gockner, Simon
|
|
// Created: 2019-09-27
|
|
// Copyright(c) 2019 SimonG. All Rights Reserved.
|
|
|
|
using System;
|
|
using Lib.Logging.Interfaces;
|
|
|
|
namespace Lib.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() => $"{Timestamp:u}: [{Component}] {Message}\n";
|
|
}
|
|
} |