| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- using SWRIS.Extensions;
- using System;
- using System.ComponentModel;
- namespace SWRIS.Core
- {
- public static class LogHelper
- {
- static LogHelper()
- {
- _logger.LogPath = FileHelper.GetPhysicalPath("Log");
- }
- public static string LogPath
- {
- set => _logger.LogPath = value;
- }
- public static void Info(string message, Exception exception = null)
- {
- _logger.Log(message, LogLevel.Info.GetDescription(), exception);
- }
- public static void Debug(string message, Exception exception = null)
- {
- _logger.Log(message, LogLevel.Debug.GetDescription(), exception);
- }
- public static void Warn(string message, Exception exception = null)
- {
- _logger.Log(message, LogLevel.Warn.GetDescription(), exception);
- }
- public static void Error(string message, Exception exception = null)
- {
- _logger.Log(message, LogLevel.Error.GetDescription(), exception);
- }
- public static void Fatal(string message, Exception exception = null)
- {
- _logger.Log(message, LogLevel.Fatal.GetDescription(), exception);
- }
- private static readonly SimpleLogger _logger = new SimpleLogger();
- private enum LogLevel
- {
- [Description("信息")]
- Info,
- [Description("调试")]
- Debug,
- [Description("警告")]
- Warn,
- [Description("错误")]
- Error,
- [Description("严重错误")]
- Fatal
- }
- }
- }
|