-
Notifications
You must be signed in to change notification settings - Fork 0
/
ProjectMethods.cs
47 lines (44 loc) · 1.5 KB
/
ProjectMethods.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
using System;
using System.IO;
namespace DBTableMover
{
/// <summary>
/// methods that can be used throughout the project in different forms and classes
/// </summary>
public class ProjectMethods
{
public ProjectMethods()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// this is an internal function to write debug information to a textfile
/// </summary>
/// <param name="message"></param>
public static void WriteLog(string message)
{
StreamWriter logFile = new StreamWriter(System.AppDomain.CurrentDomain.BaseDirectory + @"\debug.txt", true);
logFile.WriteLine(DateTime.Now + " " + message);
logFile.Flush();
logFile.Close();
}
/// <summary>
/// this is an internal function to write debug information to a textfile
/// </summary>
/// <param name="caller">the name of the calling function</param>
/// <param name="message">the message to write</param>
public static void WriteLog(string caller, string message)
{
if (ProjectVariables.debugMode)
{
// only write to the log, if the debug mode is on
StreamWriter logFile = new StreamWriter(System.AppDomain.CurrentDomain.BaseDirectory + @"\debug.txt", true);
logFile.WriteLine(DateTime.Now + " " + caller + " " + message);
logFile.Flush();
logFile.Close();
}
}
}
}