using Serilog; using System.Diagnostics; namespace HKLog { public class HKLogImport { public static void Init(string input) { var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Logs",$"{input}.log"); //日志 Log.Logger = new LoggerConfiguration() .MinimumLevel.Information() .WriteTo.File(path, 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()); } } }