Files

57 lines
1.5 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System;
namespace XP.Hardware.PLC.Sentry.Models
{
/// <summary>
/// Sentry 操作日志级别枚举 | Sentry operation log level enumeration
/// </summary>
public enum SentryLogLevel
{
/// <summary>
/// 信息 | Information
/// </summary>
Info,
/// <summary>
/// 警告 | Warning
/// </summary>
Warning,
/// <summary>
/// 错误 | Error
/// </summary>
Error
}
/// <summary>
/// Sentry 操作日志条目模型 | Sentry operation log entry model
/// </summary>
public class SentryLogEntry
{
/// <summary>
/// 时间戳 | Timestamp
/// </summary>
public DateTime Timestamp { get; set; }
/// <summary>
/// 格式化的时间戳显示(HH:mm:ss.fff| Formatted timestamp display
/// </summary>
public string TimestampDisplay => Timestamp.ToString("HH:mm:ss.fff");
/// <summary>
/// 日志消息 | Log message
/// </summary>
public string Message { get; set; } = string.Empty;
/// <summary>
/// 日志级别 | Log level
/// </summary>
public SentryLogLevel Level { get; set; } = SentryLogLevel.Info;
/// <summary>
/// 用于显示的格式化文本 | Formatted text for display
/// </summary>
public string DisplayText => $"[{TimestampDisplay}] [{Level}] {Message}";
}
}