2022-05-05 14:46:04 +02:00
|
|
|
|
namespace Logging
|
2022-05-05 02:01:05 +02:00
|
|
|
|
{
|
|
|
|
|
public class Logger
|
|
|
|
|
{
|
|
|
|
|
private LogType logType;
|
|
|
|
|
private string logfilepath;
|
|
|
|
|
public Logger(LogType type)
|
|
|
|
|
{
|
|
|
|
|
this.logType = type;
|
|
|
|
|
this.logfilepath = "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Logger(LogType type, string path)
|
|
|
|
|
{
|
|
|
|
|
this.logType = type;
|
|
|
|
|
this.logfilepath = path;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void log(string message)
|
|
|
|
|
{
|
|
|
|
|
switch (this.logType)
|
|
|
|
|
{
|
|
|
|
|
case LogType.Console:
|
|
|
|
|
Console.WriteLine(message);
|
|
|
|
|
break;
|
|
|
|
|
case LogType.Logfile:
|
|
|
|
|
File.WriteAllText(this.logfilepath, message);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum LogType { Console, Logfile }
|
|
|
|
|
}
|