20 public Logger(
string filename,
bool toFile =
true)
24 Log.Logger =
new LoggerConfiguration().WriteTo.File(filename).CreateLogger();
34 public void info(
string info,
bool writeToConsole =
true)
39 Console.WriteLine(
info);
48 public void info(
string info, ConsoleColor color)
51 Console.ForegroundColor = color;
52 Console.WriteLine(
info);
66 Console.ForegroundColor = ConsoleColor.Red;
77 public void error(
string error,
bool writeToConsole =
true)
82 Console.ForegroundColor = ConsoleColor.Red;
83 Console.WriteLine(
error);
98 Console.ForegroundColor = ConsoleColor.Green;
100 Console.ResetColor();
Class for logging messages to a file.
Logger(string filename, bool toFile=true)
Logger constructor.
bool logToFile
If messages should be written to file or only printed to stdout.
void dispose()
Close and flush the logger.
void info(string info, ConsoleColor color)
Log information and print to stdout with specified color.
void success(string success, bool writeToConsole=true)
Log success.
void error(string error, bool writeToConsole=true)
Log error.
void info(string info, bool writeToConsole=true)
Log information.
void warning(string warning, bool writeToConsole=true)
Log warning.