static void Main(string[] args) { log.Error("Main", new Exception("发生了一个异常")); //错误 log.Fatal("Main", new Exception("发生了一个致命错误")); //严重错误 log.Info("Main", "信息"); //记录一般信息 log.Debug("Main", "调试信息"); //记录调试信息 log.Warn("Main", "警告"); //记录警告信息 Console.ReadKey(); }
public void Basic_Log_Test() { // Using custom default log XLog customLogInstance = XLog.Create((config) => { config.FileName = () => $"log_{DateTime.Now:dd MM yy}"; config.ApplicationName = Assembly.GetExecutingAssembly().GetName().Name; config.LogDirectory = @"D:\new log"; }); customLogInstance.Info("Log file to d drive !!"); // Using default log XLog.Log.Info("Log Info"); XLog.Log.Debug("Log Debug"); XLog.Log.Error("Log Error"); XLog.Log.Error(new NotImplementedException()); XLog.Log.Warn("Log Warning"); }
private void MainWindow_OnStateChanged(object sender, EventArgs e) { log.Info("MainWindow", WindowState.ToString()); }