-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAppFlowLog.cs
57 lines (50 loc) · 1.05 KB
/
AppFlowLog.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
* Created by SharpDevelop.
* User: Joe
* Date: 14/06/2010
* Time: 4:53 PM
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
namespace ET2Solver
{
/// <summary>
/// A class to log and visualise application function flowchart / execution logic
/// </summary>
public class AppFlowLog
{
public int max_log_size = 1000;
private int indent = 0;
private List<string> log = new List<string>();
public AppFlowLog()
{
}
public void open(string text)
{
this.comment(text);
this.indent++;
}
public void close(string text)
{
if ( this.indent > 0 )
{
this.indent--;
}
this.comment(text);
}
public void comment(string text)
{
if ( this.max_log_size > this.log.Count )
{
text = String.Format("{0}{1}", new String('.', this.indent*2), text);
this.log.Add(text);
}
}
public string getLog()
{
return String.Join("\r\n", this.log.ToArray());
}
}
}