12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using NLog;
- namespace Bowin.Common.Log
- {
- public enum LogType
- {
- CommmLog, //通用日志
- ServiceLog
- }
- public class LogHelper
- {
- /// <summary>
- /// 直接使用这个的话,类型就是Info(信息)
- /// </summary>
- /// <param name="logType"></param>
- /// <param name="message"></param>
- public static void WriteLog(LogType logType, string message)
- {
- //不要重载
- LogManager.GetLogger(logType.ToString()).Log(LogLevel.Info, message.Replace("'", "''"));
- }
- public static void WriteErrorLog(LogType logType, string message)
- {
- //不要重载
- LogManager.GetLogger(logType.ToString()).Log(LogLevel.Error, message.Replace("'", "''"));
- }
- public static void WriteLog(LogType logType, string message, LogLevel logLevel)
- {
- //不要重载
- LogManager.GetLogger(logType.ToString()).Log(logLevel, message.Replace("'", "''"));
- }
- public static void WriteDebugLog(LogType logType, string message)
- {
- //不要重载
- LogManager.GetLogger(logType.ToString()).Log(LogLevel.Debug, message.Replace("'", "''"));
- }
- }
- }
|