using System; using System.IO; using BP.Pub; using BP.Sys; namespace BP.DA { /// /// 信息类型 /// public enum LogType { /// /// Bug. /// Debug = 0, /// /// 提示 /// Info = 1, /// /// 警告 /// Warning = 2, /// /// 错误 /// Error = 3 } /// /// 日志 /// public class Log { private static NLog.Logger _logger = null; private static NLog.Logger logger { get { try { if (_logger != null) return _logger; _logger = NLog.LogManager.GetCurrentClassLogger(); return _logger; } catch (Exception ex) { return null; } } } #region 在测试状态下 public static void DebugWriteInfo(string msg) { if (logger != null) logger.Info(msg); } public static void DebugWriteWarning(string msg) { if (logger != null) logger.Warn(msg); } public static void DebugWriteError(string msg) { if (logger != null) logger.Error(msg); } public static void DebugWriteError(Exception ex) { if (logger != null) logger.Error(ex.Message); } #endregion } }