using Serilog; using System.Diagnostics; namespace HKLog { public class HKLogImport { public static void Init(string input) { //日志 Log.Logger = new LoggerConfiguration() .MinimumLevel.Information() .WriteTo.File($"Logs/{input}.log", rollingInterval: RollingInterval.Day) .CreateLogger(); } public static void WriteInfo(string msg) { Log.Logger.Information(msg); Debug.WriteLine(msg); } public static void WriteError(Exception ex) { Log.Logger.Error(ex, ex.Message); Debug.WriteLine(ex.ToString()); } } }