forked from shiftwinting/FastGithub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUdpLog.cs
32 lines (24 loc) · 761 Bytes
/
UdpLog.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Windows;
namespace FastGithub.UI
{
public class UdpLog
{
public DateTime Timestamp { get; set; }
public LogLevel Level { get; set; }
public string Message { get; set; } = string.Empty;
public string SourceContext { get; set; } = string.Empty;
public string Color => this.Level <= LogLevel.Information ? "#333" : "IndianRed";
/// <summary>
/// 复制到剪贴板
/// </summary>
public void SetToClipboard()
{
Clipboard.SetText($"{this.Timestamp:yyyy-MM-dd HH:mm:ss.fff}\r\n{this.Message}");
}
}
}