public void Log(LogLevel level, object item) { string message = $"[{DateTime.Now:hh:mm:ss}] {level.GetDisplayString()}{Environment.NewLine}{item}{Environment.NewLine}"; string filename = GetFileName(level); File.AppendAllText(Path.Combine(_directory, filename + ".log"), message); }
public void Log(LogLevel logLevel, object item) { _defaultColor = Console.ForegroundColor; Console.ForegroundColor = GetConsoleColor(logLevel); var message = $"[{DateTime.Now:hh:mm:ss}] {logLevel.GetDisplayString()}{Environment.NewLine}{item}{Environment.NewLine}"; Console.WriteLine(message); Console.ForegroundColor = _defaultColor; }