forked from Redth/PushSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLog.cs
39 lines (33 loc) · 937 Bytes
/
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PushSharp.Core
{
public class Log
{
public static LogLevel Level = LogLevel.None;
public static void Info(string format, params object[] objs)
{
if (((int)Level) >= ((int)LogLevel.Info))
Console.WriteLine("INFO [" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "] " + format, objs);
}
public static void Warning(string format, params object[] objs)
{
if (((int)Level) >= ((int)LogLevel.Warning))
Console.WriteLine("WARN [" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "] " + format, objs);
}
public static void Error(string format, params object[] objs)
{
if (((int)Level) >= ((int)LogLevel.Error))
Console.WriteLine("ERR [" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "] " + format, objs);
}
}
public enum LogLevel
{
None = 0,
Warning = 1,
Error = 2,
Info = 3
}
}