-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLogging.cs
38 lines (32 loc) · 1.51 KB
/
Logging.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
using System;
using Gurock.SmartInspect;
namespace TestRadius
{
class Logging
{
public Logging()
{
string exepath = System.Reflection.Assembly.GetExecutingAssembly().Location;
string aName = System.Reflection.Assembly.GetExecutingAssembly().FullName.Split(',')[0];
string logfile = @"\TestRadius.log";
string logpath = exepath.Substring(0, exepath.LastIndexOf(@"\"));
logpath = logpath + logfile;
string aVersion = System.Diagnostics.FileVersionInfo.GetVersionInfo(exepath).FileVersion;
SiAuto.Si.Error += new Gurock.SmartInspect.ErrorEventHandler(Si_Error);
SiAuto.Si.SetVariable("logfile", logpath);
SiAuto.Si.LoadConfiguration(exepath.Substring(0, exepath.LastIndexOf(@"\")) + @"\Settings\TestRadius.sic");
SiAuto.Main.LogMessage("*******************************************************");
SiAuto.Main.LogMessage("{0} Computer Name: {1} Version: {2}", aName, Environment.MachineName, aVersion);
SiAuto.Main.LogMessage("*******************************************************");
}
private void Si_Error(object sender, Gurock.SmartInspect.ErrorEventArgs e)
{
Console.WriteLine(e.Exception);
if (e.Exception is LoadConfigurationException)
{
LoadConfigurationException le = (LoadConfigurationException)e.Exception;
Console.WriteLine(le.FileName);
}
}
}
}