|
123456789101112131415161718192021222324 |
- using Serilog;
-
- 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);
- }
- public static void WriteError(Exception ex)
- {
- Log.Logger.Error(ex, ex.Message);
- }
- }
- }
|