You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

HKLogImport.cs 611 B

2 years ago
123456789101112131415161718192021222324
  1. using Serilog;
  2. namespace HKLog
  3. {
  4. public class HKLogImport
  5. {
  6. public static void Init(string input)
  7. {
  8. //日志
  9. Log.Logger = new LoggerConfiguration()
  10. .MinimumLevel.Information()
  11. .WriteTo.File($"Logs/{input}.log", rollingInterval: RollingInterval.Day)
  12. .CreateLogger();
  13. }
  14. public static void WriteInfo(string msg)
  15. {
  16. Log.Logger.Information(msg);
  17. }
  18. public static void WriteError(Exception ex)
  19. {
  20. Log.Logger.Error(ex, ex.Message);
  21. }
  22. }
  23. }