-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Alt.Log.cs
77 lines (62 loc) · 2.3 KB
/
Alt.Log.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
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
using System;
using System.Text;
namespace AltV.Net
{
public static partial class Alt
{
private const string HourWithZero = "[0";
private const string HourWithoutZero = "[";
private const string NumberWithZero = ":0";
private const string NumberWithoutZero = ":";
private const string Ending = "] ";
public static void LogFast(string message)
{
var dateTimeNow = DateTime.Now;
var hour = dateTimeNow.Hour;
var minute = dateTimeNow.Minute;
var second = dateTimeNow.Second;
var stringBuilder = new StringBuilder();
stringBuilder.Append(hour < 10 ? HourWithZero : HourWithoutZero);
stringBuilder.Append(hour);
stringBuilder.Append(minute < 10 ? NumberWithZero : NumberWithoutZero);
stringBuilder.Append(minute);
stringBuilder.Append(second < 10 ? NumberWithZero : NumberWithoutZero);
stringBuilder.Append(second);
stringBuilder.Append(Ending);
stringBuilder.Append(message);
Console.WriteLine(stringBuilder.ToString());
}
/// <summary>
/// Logging a message as Information about something
/// </summary>
/// <param name="message">a message</param>
public static void LogInfo(string message)
{
Alt.CoreImpl.LogInfo(message);
}
/// <summary>
/// Logging a message if Debug-Mode is enabled
/// </summary>
/// <param name="message">a message</param>
public static void LogDebug(string message)
{
Alt.CoreImpl.LogDebug(message);
}
/// <summary>
/// Logging a message as Warning about something maybe being wrong, but not being very important
/// </summary>
/// <param name="message"> a message</param>
public static void LogWarning(string message)
{
Alt.CoreImpl.LogWarning(message);
}
/// <summary>
/// Logging a message as Error about something going very wrong, which needs immediate action
/// </summary>
/// <param name="message">a message</param>
public static void LogError(string message)
{
Alt.CoreImpl.LogError(message);
}
}
}