/* Sog 游戏基础库 2016 by zouwei */ namespace Sog.Log { /// /// 日志等级定义和辅助方法 /// public static class LogLevel { public const int Any = 0; public const int TraceDetail = 1; public const int Trace = 2; public const int Debug = 3; public const int Error = 4; public const int Fatal = 5; public const int None = 10; public static string LevelToString(int logLevel) { switch (logLevel) { case LogLevel.TraceDetail: return "L"; case LogLevel.Trace: return "T"; case LogLevel.Debug: return "D"; case LogLevel.Error: return "E"; case LogLevel.Fatal: return "F"; } return ""; } public static int ParseFromString(string strLevel) { if(string.IsNullOrEmpty(strLevel)) { return LogLevel.Debug; } string lowStrLevel = strLevel.ToLower(); if (lowStrLevel == "tracedetail") { return LogLevel.TraceDetail; } else if (lowStrLevel == "trace") { return LogLevel.Trace; } else if(lowStrLevel == "debug") { return LogLevel.Debug; } else if(lowStrLevel == "error") { return LogLevel.Error; } else if(lowStrLevel == "fatal") { return LogLevel.Fatal; } else if(lowStrLevel == "none") { return LogLevel.None; } return LogLevel.Debug; } } //改成static,允许修改 public class LogDefaultParam { public static int ShiftFileSize = 1024 * 1024 * 50; // 10M file shift public static int ShiftFileCount = 5; //5 file public static int CloseTimeoutLogFileTime = 300; // 多少秒后关闭没有再写请求的文件,释放句柄 } }