Ejemplo n.º 1
0
        public static void ProgramLog(LogFile.Level loglevel, string source, string log)
        {
            lock (LogLock)
            {
                string fileName = $"{LogFile.DefaultLogPath}Log{DateTime.Today:yyyyMMdd}.LOG";
                if (_log.LogFileName != fileName)
                {
                    _log = new LogFile(fileName, true, LogFile.Level.All, true);
                    foreach (ILogControl control in _logControl)
                    {
                        _log.AddLogControl(control);
                    }
                }
                switch (loglevel)
                {
                case LogFile.Level.Debug:
                    _log.LogDebug(source, log);
                    break;

                case LogFile.Level.Error:
                    _log.LogError(source, log);
                    break;

                case LogFile.Level.Fatal:
                    _log.LogFatal(source, log);
                    break;

                case LogFile.Level.Info:
                    _log.LogInfo(source, log);
                    break;

                case LogFile.Level.Notice:
                    _log.LogNotice(source, log);
                    break;

                case LogFile.Level.Success:
                    _log.LogSuccess(source, log);
                    break;

                case LogFile.Level.Warning:
                    _log.LogWarning(source, log);
                    break;
                }
            }
        }