Log utility based on File with File.AppendAllText
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public static class Logger
{
private static string logFile = @"logz.txt";
private static string errorLogFile = @"errorLogz.txt";
public static void Log(string s)
{
System.IO.File.AppendAllText(logFile, DateTime.Now + ": " + s + Environment.NewLine);
}
public static void LogError(string s)
{
System.IO.File.AppendAllText(errorLogFile, DateTime.Now + ": " + s + Environment.NewLine);
}
}
Related examples in the same category