-
Notifications
You must be signed in to change notification settings - Fork 0
/
Logger.cs
43 lines (37 loc) · 1.14 KB
/
Logger.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
using HomeSeerAPI;
using System;
using System.Globalization;
namespace Hspi
{
class Logger
{
private string Name { get; set; }
public IHSApplication HS { get; set; }
public bool EnableDebug { get; set; }
public Logger(string name, IHSApplication HS = null, bool enableDebug = true)
{
this.Name = name;
this.HS = HS;
this.EnableDebug = enableDebug;
}
public void LogDebug(string message)
{
if (this.EnableDebug)
{
HS.WriteLog(this.Name, String.Format(CultureInfo.InvariantCulture, "Debug:{0}", message));
}
}
public void LogError(string message)
{
HS.WriteLogEx(this.Name, String.Format(CultureInfo.InvariantCulture, "Error:{0}", message), "#FF0000");
}
public void LogInfo(string message)
{
HS.WriteLog(this.Name, message);
}
public void LogWarning(string message)
{
HS.WriteLogEx(this.Name, String.Format(CultureInfo.InvariantCulture, "Warning:{0}", message), "#D58000");
}
}
}