-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
56 lines (47 loc) · 1.82 KB
/
Program.cs
File metadata and controls
56 lines (47 loc) · 1.82 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
using System;
using System.Diagnostics.Eventing.Reader;
using System.Linq;
using System.Text;
namespace LogWatcher
{
class Program
{
static void Main(string[] args)
{
if (args.Length != 0 && args[0] != "/?" && args[0] != "help" && args[0] != "--help")
{
var OnlyLogsAfter = DateTime.Now.AddHours(-1);
LogLevel level;
if (!(args.Length > 1 && LogLevel.TryParse(args[1], out level)))
level = LogLevel.Debug;
//var
var watches = args[0].Split(',')
.Select(cla => // build our log file watchers
{
string[] split = cla.Split(':');
switch (split.Length)
{
case 1:
return new Rolex(split[0], 'c');
case 2:
return new Rolex(split[0], split[1][0]);
default:
throw new ArgumentException("Are you missing a comma?\nUnexpected extra ':' in string " + cla);
}
}).ToArray().ToArray();
Rolex.ConfluentStreams(watches, OnlyLogsAfter, 2000, level);
}
else // Show Help msg
{
Console.WriteLine(
"Help for LogWatcher.exe --\n"+
"\n" +
"Streams the logs\n" +
"\n" +
"Example Usage:\n"+
"LogWatcher.exe <EngineMachine0>:<DriveLetter>,<EngineMachine1>:<DriveLetter>,<EngineMachineN>:DriveLetter>\n"+
"LogWatcher.exe chic-hdge-qadb:c,chic-jenk-db1:d");
}
}
}
}