コード例 #1
0
 internal MethodCallLogger(ErrorLogger log)
 {
     _Log = log;
     _Timer.Elapsed += TimerOnElapsed;
     LoadSettings();
     _Timer.Enabled = true;
 }
コード例 #2
0
ファイル: DebugLog.cs プロジェクト: ashish-antil/Products
 static DebugLog()
 {
     _Timer = new Timer(Init, null, TimeSpan.FromMinutes(3), TimeSpan.FromSeconds(90));
     var path = ConfigUtils.GetString("DebugLogFolder");
     if (path != null)
     {
         Init(null);
         _Log = ErrorLogger.GetLogger(path, "DebugLog");
         Filter = ConfigUtils.GetString("DebugLogFilter");
     }
 }
コード例 #3
0
ファイル: ErrorLogger.cs プロジェクト: ashish-antil/Products
        public static ErrorLogger GetLogger(string dir, string name, string suffix)
        {
            lock (_Logs)
            {
                ErrorLogger logger;
                if (_Logs.TryGetValue(name, out logger)) return logger;
                int port;
                string s = ConfigUtils.GetString(name + "_LoggerUdpPort", "LoggerUdpPort");
                if (!string.IsNullOrEmpty(s) && int.TryParse(s, out port) && port > 0)
                {
                    string s2 = ConfigUtils.GetString(name + "_LoggerNewFile", "LoggerNewFile");
                    int num;
                    NewFile newFileCriterion = NewFile.UtcMidnight;

                    if (!string.IsNullOrEmpty(s2) && int.TryParse(s2, out num)) newFileCriterion = (NewFile)num;
                    if (string.IsNullOrEmpty(dir)) dir = DefaultLogFolder;

                    int maxLevel = ConfigUtils.GetInt(name + "_MaxLevel", "MaxLogLevel");
                    if (maxLevel == 0) maxLevel = 1;
                    int eventLevel = ConfigUtils.GetInt("EventLevel", 1);
                    int tallyLevel = ConfigUtils.GetInt("TallyLevel", 1);

                    string udpServer = ConfigUtils.GetString(name + "_LoggerUdpServer", "");

                    logger = new ErrorLogger(udpServer, port, dir, name, suffix, newFileCriterion, maxLevel, eventLevel, tallyLevel);
                }
                else
                {
                    string s2 = ConfigUtils.GetString(name + "_LoggerNewFile", "LoggerNewFile");
                    int num;
                    NewFile newFileCriterion = NewFile.UtcMidnight;

                    if (!string.IsNullOrEmpty(s2) && int.TryParse(s2, out num)) newFileCriterion = (NewFile)num;
                    if (string.IsNullOrEmpty(dir)) dir = DefaultLogFolder;

                    int maxLevel = ConfigUtils.GetInt(name + "_MaxLevel", "MaxLogLevel");
                    if (maxLevel == 0) maxLevel = 1;
                    int eventLevel = ConfigUtils.GetInt("EventLevel", 1);
                    int tallyLevel = ConfigUtils.GetInt("TallyLevel", 1);
                    logger = new ErrorLogger(dir, name, suffix, newFileCriterion, maxLevel, eventLevel, tallyLevel);
                }
                logger.Name = name;
                _Logs.Add(name, logger);
                return logger;
            }
        }