-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathApplicationLog.cs
More file actions
57 lines (49 loc) · 1.81 KB
/
ApplicationLog.cs
File metadata and controls
57 lines (49 loc) · 1.81 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//
// C# (.Net Framework)
// IncominHttpServer
// https://github.com/dkxce/IncominHttpServer
// en,ru,1251,utf-8
//
using System;
namespace IncominHttpServer
{
internal static class ApplicationLog
{
public static Form1 form = null;
private static void Write(string text)
{
if (form == null) return;
form.WriteProcLog(text);
}
public static void WriteQuery(string text)
{
if (form == null) return;
text = text?.Replace("\r", "").Replace("\n", "\r\n") + "\r\n";
text = string.Format("---- {0} ----\r\n{1}", DateTime.UtcNow.ToString("HH:mm:ss MM.dd.yyyy"), text);
form.WriteQueryLog(text);
form.WriteLastQuery(text, false);
}
public static void WriteResponse(string text)
{
if (form == null) return;
text = text?.Replace("\r", "").Replace("\n", "\r\n") + "\r\n";
text = string.Format("---- {0} ----\r\n{1}", DateTime.UtcNow.ToString("HH:mm:ss MM.dd.yyyy"), text);
form.WriteRespLog(text, false);
}
public static void WriteInvoke(string text)
{
if (form == null) return;
text = text?.Replace("\r", "").Replace("\n", "\r\n") + "\r\n";
text = string.Format("---- {0} ----\r\n{1}", DateTime.UtcNow.ToString("HH:mm:ss MM.dd.yyyy"), text);
form.WriteInvLog(text, false);
}
public static void WriteLn(string text)
{
Write(text?.Replace("\r", "").Replace("\n", "\r\n") + "\r\n");
}
public static void WriteDatedLn(string text)
{
WriteLn(string.Format("{0}: {1}", DateTime.UtcNow.ToString("yyyyMMddHHmmss"), text));
}
}
}