forked from wakatime/visualstudio-wakatime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLogger.cs
40 lines (35 loc) · 1.23 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
using System;
using Microsoft.VisualStudio.Shell.Interop;
using System.Globalization;
namespace WakaTime.WakaTime {
/// <summary>
/// Singleton class for logging in Visula studio default logger file ActivityLog.xml
/// </summary>
class Logger {
private static Logger _instance;
private IVsActivityLog _log;
public static Logger Instance {
get {
if (_instance == null) {
_instance = new Logger();
}
return _instance;
}
}
public void initialize(IVsActivityLog log) {
_log = log;
}
public void error(string message) {
_log.LogEntry((UInt32)__ACTIVITYLOG_ENTRYTYPE.ALE_ERROR,
this.ToString(),
string.Format(CultureInfo.CurrentCulture,
"{0}", message));
}
public void info(string message) {
_log.LogEntry((UInt32)__ACTIVITYLOG_ENTRYTYPE.ALE_INFORMATION,
this.ToString(),
string.Format(CultureInfo.CurrentCulture,
"{0}", message));
}
}
}