-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLogging.cs
More file actions
36 lines (33 loc) · 1006 Bytes
/
Logging.cs
File metadata and controls
36 lines (33 loc) · 1006 Bytes
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
using System;
namespace SAHC
{
public enum LogType
{
Start,
Finish,
BitsCountForEncode,
BitsCountForDecode
}
public static class Log
{
/// <summary> Log to the console if debug mode. </summary>
public static void Write(LogType type, object value)
{
#if DEBUG
var message = GetMessage(type, value);
Console.WriteLine(message);
#endif
}
private static string GetMessage(LogType type, object value)
{
return type switch
{
LogType.Start => $"Start encoding the message: {value}",
LogType.Finish => $"Finish decoding the message: {value}",
LogType.BitsCountForEncode => $"Count of bits for encode: {value}",
LogType.BitsCountForDecode => $"Count of bits for decode: {value}",
_ => throw new ArgumentOutOfRangeException(nameof(type), type, null)
};
}
}
}