Example #1
0
		///<summary>
		/// Logs the message to the configured loLog4Netgger with the 
		/// appropriate <see cref="LogCategory"/>
		///</summary>
		///<param name="message"></param>
		///<param name="logCategory"></param>
		public void Log(string message, LogCategory logCategory)
		{
			if (!IsLogging(logCategory)) return;
			switch (logCategory)
			{
				case LogCategory.Fatal:
					_log.Fatal(message);
					break;
				case LogCategory.Exception:
					_log.Error(message);
					break;
				case LogCategory.Debug:
					_log.Debug(message);
					break;
				case LogCategory.Warn:
					_log.Warn(message);
					break;
                case LogCategory.Error:
                    _log.Error(message);
                    break;
				default:
					_log.Info(message);
					break;
			}
		}
 public void Log(string message, LogCategory logCategory)
 {
     if (!IsLogging(logCategory)) return;
     Console.Out.WriteLine("{0} {1} {2} {3} {4}", DateTime.Now.ToShortDateString(),
                           DateTime.Now.ToShortTimeString(), _contextName,
                           Enum.GetName(typeof (LogCategory), logCategory), message);
 }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LogEntry"/> class by specifying the category and the detailed information to write.
 /// </summary>
 /// <param name="category">
 /// The log category of this instance.
 /// </param>
 /// <param name="data">
 /// The data containing the detailed information to write to log.
 /// </param>
 public LogEntry(LogCategory category, object data)
 {
     Id = Guid.NewGuid();
     Category = category;
     Created = DateTime.Now;
     Data = data;
 }
Example #4
0
 public void Log(LogCategory category, string text, params object[] parameters)
 {
     if ((EnabledCategories & category) != 0)
     {
         Stream.WriteLine(text, parameters);
     }
 }
Example #5
0
        /// <summary>
        /// This method is used to Log any message in the Application.
        /// </summary>
        /// <param name="eventId">Id of the event. Based on which the message will be retrieved from resource file.</param>
        /// <param name="ex">Exception object that needs to be logged in.</param>
        /// <param name="message">Some extra information / message that user will like to log.</param>
        /// <param name="category">A category which will determine where the message will get logged.</param>
        /// <param name="severity">Severity of the message. (Information / Warning / Error)</param>
        public static void LogException(int eventId, Exception ex, string message, LogCategory category, TraceEventType severity)
        {
            try
            {
                var categories = new List<LogCategory> { category };

                var extendedInformation = new Dictionary<string, object> { { "Exception", ex } };

                if (string.IsNullOrEmpty(message))
                {
                    message = ex.Message + " - Stack Trace : " + ex.StackTrace;
                }
                else
                {
                    message = message + " - " + ex.Message + " - Stack Trace : " + ex.StackTrace;
                    if (message.Length > MAX_EVENTLOG_STRING_LENGTH)
                        message = message.Substring(0, MAX_EVENTLOG_STRING_LENGTH);
                }

                WriteLogEntry(eventId, message, categories, severity, extendedInformation);
            }
            catch (Exception)
            {
            }
        }
Example #6
0
 public static void SetTraceLevel(LogCategory category, SourceLevels sourceLevel)
 {
     var sourceSwitch = new SourceSwitch(string.Format(CultureInfo.InvariantCulture, "MigSharp.{0}.Switch", category))
     {
         Level = sourceLevel
     };
     Sources[category].Switch = sourceSwitch;
 }
 public static void Log(this IEnumerable<Logging.ILog> logs, LogCategory category, string message)
 {
     if (null == logs)
         return;
     foreach (var l in logs)
         if(null != l)
             l.Log(category, message);
 }
 public override void Log(LogCategory category, string message)
 {
     if (this.Stack.Count == 0)
         return;
     var ts = this.Stack.Peek();
     if(null != ts)
         ts.Log(category, message);
 }
Example #9
0
 /// <summary>
 /// Writes a log entry via the logger from <see cref="Logger.Current" />.
 /// </summary>
 /// <param name="msg">The message to write.</param>
 /// <param name="category">The category.</param>
 /// <param name="prio">The priority.</param>
 /// <param name="tag">The optional tag.</param>
 /// <returns>Message was written or not.</returns>
 public static bool Log(object msg,
                        LogCategory category = LogCategory.Info, LogPriority prio = LogPriority.None,
                        string tag = null)
 {
     return Current.Log(msg: msg,
                        category: category, prio: prio,
                        tag: tag);
 }
 public override void Log(LogCategory category, string message)
 {
     System.Diagnostics.Debug.WriteLine
         (
         "{0}ms\t{1}",
         this.Elapsed.TotalMilliseconds,
         message
         );
 }
        public static void LogEntryAsync(string message, LogSeverity logSeverity, LogCategory logCategory)
        {
            Task.Factory.StartNew(() => Logger.Write(new LogEntry
            {
	            Title = logCategory.ToString(),
	            Message = message,
	            Categories = new List<string> { logCategory.ToString() },
	            Severity = GetSeverity(logSeverity)
            }));
        }
Example #12
0
        /// <summary>
        /// Async operation of <see cref="LoggerBase.Log(object, LogCategory, LogPriority, string)" /> method.
        /// </summary>
        /// <param name="msg">The message.</param>
        /// <param name="category">The category.</param>
        /// <param name="prio">The priority.</param>
        /// <param name="tag">The tag.</param>
        /// <returns>The started task.</returns>
        public Task<bool> LogAsync(object msg,
                                   LogCategory category = LogCategory.Info, LogPriority prio = LogPriority.None,
                                   string tag = null)
        {
            var logMsg = CreateMessage(msg: msg,
                                       category: category, prio: prio,
                                       tag: tag);

            return LogAsync(logMsg: logMsg);
        }
 public static void LogEntry(string message, LogSeverity logSeverity, LogCategory logCategory)
 {
     Logger.Write(new LogEntry
     {
         Title = logCategory.ToString(),
         Message = message,
         Categories = new List<string> { logCategory.ToString() },
         Severity = GetSeverity(logSeverity)
     });
 }
Example #14
0
 public static LogMessage Create(LogCategory logCategory, LogSeverity logSeverity, string description)
 {
     return new LogMessage
         {
             Category = logCategory,
             Severity = logSeverity,
             Description = description,
             CreatedBy = "System",
             CreatedDate = DateTime.Now
         };
 }
Example #15
0
        //[Conditional("TRACE")]
        public static void Trace(LogCategory category, string message, params object[] args)
        {
            //Queue.Queue(delegate
            //{
                ThreadContext.Properties["Category"] = category;
                string messageToLog = string.Format(message, args);

                ConsoleLog(ConsoleColor.Gray, message, args);
                _logger.Logger.Log(typeof(Log), TRACELevelTRACE, messageToLog, null);
            //});
        }
Example #16
0
        /// <summary>
        /// Write a trace line with message and category.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="category">The category.</param>
        public static void WriteLine(string message, LogCategory category) {
#if DEBUG
            try {
                System.Diagnostics.Trace.WriteLine(message, category.GetDescription());
            } catch (StackOverflowException ex) {
                Console.WriteLine(ex);
            }
#else            
            if(category != LogCategory.Debug)
                System.Diagnostics.Trace.WriteLine(message, category.GetDescription());
#endif
        }
Example #17
0
        public void Log(string msg, LogPriority priority, LogCategory category)
        {
            string padding = "------";

              Console.WriteLine(padding);

              Console.WriteLine(category.ToString());
              Console.WriteLine(priority.ToString());
              Console.WriteLine(msg);

              Console.WriteLine(padding);
        }
 public List<LogCategory> GetSubCategory(int fatherid)
 {
     DataTable categorytable = dal.GetSubCategory(fatherid);
     List<LogCategory> model = new List<LogCategory>();
     foreach (DataRow item in categorytable.Rows)
     {
         LogCategory mo = new LogCategory();
         mo.CategoryID = int.Parse(item["CategoryID"].ToString());
         mo.CategoryName = item["CategoryName"].ToString();
         model.Add(mo);
     }
     return model;
 }
Example #19
0
        /// <summary>
        /// This method is used to Log any message in the Application.
        /// </summary>
        /// <param name="eventId">Id of the event. Based on which the message will be retrieved from resource file.</param>
        /// <param name="ex">Exception object that needs to be logged in.</param>
        /// <param name="category">a category which will determine where the message will get logged.</param>
        /// <param name="severity">Severity of the message. (Information / Warning / Error)</param>
        public static void LogException(int eventId, Exception ex, LogCategory category, TraceEventType severity)
        {
            try
            {
                var categories = new List<LogCategory> { category };

                var extendedInformation = new Dictionary<string, object> { { "Exception", ex } };

                WriteLogEntry(eventId, ex.Message + " StackTrace : " + ex.StackTrace, categories, severity, null);
            }
            catch (Exception)
            {
            }
        }
Example #20
0
        public void Log(string message, LogCategory category, LogPriority priority)
        {
            Message = message;
            Category = category;
            Priority = priority;

            var trace = new StackTrace();
            StackFrame frame = trace.GetFrame(1);
            MethodBase method = frame.GetMethod();

            Logger.Log(LogLevel.Info, method.DeclaringType + ": " + message);

            _aggregator.GetEvent<LogEvent>().Publish(new NLogService { Message = Message, Category = Category, Priority = Priority });
        }
Example #21
0
        /// <summary>Logs the specified level.</summary>
        /// <param name="level">The logging level.</param>
        /// <param name="category">The category.</param>
        /// <param name="formatMessage">The format message.</param>
        /// <param name="args">The parameters used when format message.</param>
        public static void Log(TrinityLogLevel level, LogCategory category, string formatMessage, params object[] args)
        {
            if (string.IsNullOrEmpty(prefix))
                prefix = string.Format("[Trinity {0}]", Trinity.Instance.Version);

            if (category == LogCategory.UserInformation || level >= TrinityLogLevel.Error || (Trinity.Settings != null && Trinity.Settings.Advanced.LogCategories.HasFlag(category)))
            {
                string msg = string.Format(prefix + "{0} {1}", category != LogCategory.UserInformation ? "[" + category.ToString() + "]" : string.Empty, formatMessage);

                try
                {
                if (args.Length > 0)
                    msg = string.Format(msg, args);
                }
                catch
                {
                    msg = msg + " || " + args;
                }
                var key = new Tuple<LogCategory, TrinityLogLevel>(category, level);

                if (!LastLogMessages.ContainsKey(key))
                    LastLogMessages.Add(key, "");

                var allowDuplicates = Trinity.Settings != null && Trinity.Settings.Advanced != null && Trinity.Settings.Advanced.AllowDuplicateMessages;

                string lastMessage;
                if (LastLogMessages.TryGetValue(key, out lastMessage) && (allowDuplicates || lastMessage != msg))
                {
                    LastLogMessages[key] = msg;

                    switch (level)
                    {
                        case TrinityLogLevel.Error:
                            _Logger.Error(msg);
                            break;
                        case TrinityLogLevel.Info:
                            _Logger.Info(msg);
                            break;
                        case TrinityLogLevel.Verbose:
                            _Logger.Debug(msg);
                            break;
                        case TrinityLogLevel.Debug:
                            LogToTrinityDebug(msg);
                            break;
                    }
                }
            }
        }
Example #22
0
        /// <summary>
        /// Logs the method.
        /// </summary>
        /// <param name="section">The section.</param>
        /// <param name="category">The category.</param>
        /// <param name="method">The method.</param>
        /// <param name="parametersNames">The parameters names.</param>
        /// <param name="parametersValue">The parameters value.</param>
        /// <param name="exception">The exception.</param>
        public static void LogMethod(string section, LogCategory category, String method, string[] parametersNames, object[] parametersValue, Exception exception)
        {
            StringBuilder builder = new StringBuilder();

            builder.AppendFormat("Error when tries to execute {0}(", method);
            for (int i = 0; i < parametersNames.Length; i++)
            {
                builder.AppendFormat("{0}: [{1}]", parametersNames[i], parametersValue[i]);

                if (i != parametersNames.Length - 1)
                    builder.Append(",");
            }
            builder.Append(");");

            LogManager.Log(section, category, builder.ToString(), exception);
        }
 /// <summary>
 /// Writes a message to the log.
 /// </summary>
 /// <param name="message">The message to write.</param>
 /// <param name="category">The message category.</param>
 /// <param name="priority">The log priority.</param>
 public void Log(string message, LogCategory category, LogPriority priority)
 {
     switch (category)
     {
         case LogCategory.Debug:
             logger.Debug(message);
             break;
         case LogCategory.Warn:
             logger.Warn(message);
             break;
         case LogCategory.Exception:
             logger.Error(message);
             break;
         case LogCategory.Info:
             logger.Info(message);
             break;
     }
 }
Example #24
0
 public void Log(LogCategory category, string text, params object[] parameters)
 {
     if ((EnabledCategories & category) != 0)
     {
         Console.Write(LogHelpers.GetTimestamp());
         ConsoleColor currentColor = Console.ForegroundColor;
         Console.ForegroundColor = LogHelpers.GetCategoryColor(category);
         Console.Write(category.ToString());
         // Better to restore original than ResetColor
         Console.ForegroundColor = currentColor;
         // TODO: Check Console.BufferWidth and indent wrapping text onto the same level as the end of the timestamp
         // Longest LogCategory is Warning (length is 7 characters)
         // The log will probably mostly contain messages belonging to the
         // category Notice (6 chars). We want a pad of 4 spaces on average
         // and also want the text to be aligned with the last message
         // 7 + 4 = 11 is the max length of (category.ToString() + pad of 4 spaces)
         Console.WriteLine(new string(' ', 11 - category.ToString().Length) + text, parameters);
     }
 }
Example #25
0
 public static ConsoleColor GetCategoryColor(LogCategory category)
 {
     switch (category)
     {
         case LogCategory.Packets:
             return ConsoleColor.White;
         case LogCategory.Debug:
             return ConsoleColor.Cyan;
         case LogCategory.Warning:
             return ConsoleColor.Yellow;
         case LogCategory.Error:
             return ConsoleColor.Red;
         case LogCategory.Notice:
             return ConsoleColor.Green;
         case LogCategory.All:
             return ConsoleColor.Magenta;
         default:
             return ConsoleColor.Gray;
     }
 }
Example #26
0
    // Reserved

    #endif

    #region Constructors

    // Static constructor
    static LogManager()
    {
        string logPath = DateTime.UtcNow.ToString("yyyy-MM-dd/HH-mm-ss/");

        // Initialize log path
        #if UNITY_STANDALONE_WIN
        LogCategory.Init("./Logs/" + logPath);
        #else
        LogCategory.Init("./logs/" + logPath);
        #endif

        // Create logs
        LogManager.General = new LogCategory("General");
        LogManager.Chat = new LogCategory("Chat");
        LogManager.DB = new LogCategory("DB", false);
        LogManager.Online = new LogCategory("Online", false);
        LogManager.System = new LogCategory("System", false);
        LogManager.Spam = new LogCategory("Spam", false, false);
        #if !LOBBY_SERVER
        // Reserved
        #endif
    }
        public static void Write(LogCategory logcategory, string message, object logObject)
        {
            _log = LogManager.GetLogger(Type.GetType("System.Object"));
            log4net.Config.XmlConfigurator.Configure();

            switch (logcategory)
            {
                case LogCategory.DEBUG:
                    LOGGER._log.Debug(message,(Exception)logObject);
                    break;
                case LogCategory.INFORMATION:
                    LOGGER._log.Info(message,(Exception)logObject);
                    break;
                case LogCategory.WARNING:
                    LOGGER._log.Warn(message,(Exception)logObject);
                    break;
                case LogCategory.ERROR:
                    LOGGER._log.Error(message,(Exception)logObject);
                    break;
                case LogCategory.FATAL:
                    LOGGER._log.Fatal(message,(Exception)logObject);
                    break;
            }
        }
Example #28
0
        /// <summary>
        /// Logs the specified section.
        /// </summary>
        /// <param name="section">The section.</param>
        /// <param name="contextClass">The context class.</param>
        /// <param name="contextMethod">The context method.</param>
        /// <param name="category">The category.</param>
        /// <param name="message">The message.</param>
        /// <param name="parameters">The parameters.</param>
        public static void Log(string section, Type contextClass, string contextMethod, LogCategory category, string message, object[] parameters)
        {
            string paramList = "";

            foreach (object param in parameters)
            {
                paramList += param.ToString() + ",";
            }

            message = String.Format("Type: [{0}], \n Assembly: [{1}], \n Method: [{2}( {4} )], \n Message: {3}",
                                    contextClass.FullName,
                                    contextClass.Assembly.FullName,
                                    contextMethod,
                                    message,
                                    paramList
                                    );


            switch (category)
            {
            case LogCategory.Info:
                log4net.LogManager.GetLogger(section).Info(message);
                break;

            case LogCategory.Warn:
                log4net.LogManager.GetLogger(section).Warn(message);
                break;

            case LogCategory.Debug:
                log4net.LogManager.GetLogger(section).Debug(message);
                break;

            case LogCategory.Error:
                log4net.LogManager.GetLogger(section).Error(message);
                break;

            case LogCategory.Fatal:
                log4net.LogManager.GetLogger(section).Fatal(message);
                break;

            default:
                break;
            }
        }
Example #29
0
 public static void Log(string msg, LogCategory category, int priority, TraceEventType type, string title, IDictionary<string, object> properties, Guid? correlationId)
 {
     if (defaultWriter != null) { if (defaultWriter.IsLoggingEnabled()) { var entry = new LogEntry { Message = msg }; entry.Categories.Add(category.ToString()); entry.RelatedActivityId = correlationId; entry.Title = string.IsNullOrEmpty(title) ? Defaults.DEFAULT_LOG_TITLE : title; entry.Priority = int.MinValue == priority ? Defaults.DEFAULT_LOG_PRIORITY : priority; entry.ExtendedProperties = properties; defaultWriter.Write(entry); }                 else { Trace.WriteLine("Logging is disabled in the configuration."); } } else { System.Diagnostics.Trace.WriteLine("Log Manager is invalid (Null). Dumping the Log entry to trace event."); System.Diagnostics.Trace.WriteLine(string.Format("Msg: {0}\n Category: {1}\n Priority: {2} Title {3} Correlation ID: {4}", msg, category.ToString(), priority.ToString(), title, correlationId.ToString()));  }
 }
 public void Log(LogCategory logCategory, params object[] paramters)
 {
 }
Example #31
0
 private static extern void INTERNAL_LogMessageV(
     LogCategory category,
     LogPriority priority,
     byte[] fmtAndArglist
     );
        public async Task <Response> PutLogCategory([FromRoute] int id, [FromBody] LogCategory LogCategory)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(new Response
                    {
                        IsSuccess = false,
                        Message = Mensaje.ModeloInvalido
                    });
                }


                var existe = Existe(LogCategory);
                if (existe.IsSuccess)
                {
                    return(new Response
                    {
                        IsSuccess = false,
                        Message = Mensaje.ExisteRegistro,
                    });
                }



                var LogCategoryActualizar = await db.LogCategories.Where(x => x.LogCategoryId == id).FirstOrDefaultAsync();

                if (LogCategoryActualizar != null)
                {
                    try
                    {
                        LogCategoryActualizar.Description    = LogCategory.Description;
                        LogCategoryActualizar.Name           = LogCategory.Name;
                        LogCategoryActualizar.ParameterValue = LogCategory.ParameterValue;
                        db.LogCategories.Update(LogCategoryActualizar);
                        await db.SaveChangesAsync();

                        return(new Response
                        {
                            IsSuccess = true,
                            Message = Mensaje.Satisfactorio,
                        });
                    }
                    catch (Exception ex)
                    {
                        await GuardarLogService.SaveLogEntry(new LogEntryTranfer
                        {
                            ApplicationName      = Convert.ToString(Aplicacion.Logs),
                            ExceptionTrace       = ex.Message,
                            Message              = Mensaje.Excepcion,
                            LogCategoryParametre = Convert.ToString(LogCategoryParameter.Critical),
                            LogLevelShortName    = Convert.ToString(LogLevelParameter.ERR),
                            UserName             = "",
                        });

                        return(new Response
                        {
                            IsSuccess = false,
                            Message = Mensaje.Error,
                        });
                    }
                }


                return(new Response
                {
                    IsSuccess = false,
                    Message = Mensaje.ExisteRegistro
                });
            }
            catch (Exception)
            {
                return(new Response
                {
                    IsSuccess = false,
                    Message = Mensaje.Excepcion
                });
            }
        }
Example #33
0
 private static bool ShouldLog(LogCategory level)
 {
     return(level >= MinLogLevel);
 }
Example #34
0
        public void Info(string message, LogCategory category = LogCategory.Apocalypse)
        {
            var operation = new LogWritingOperation(LogType.Info, message, category);

            QueueOperation(operation);
        }
 public LogCategoryAttribute(LogCategory category)
 {
     Category = category;
 }
Example #36
0
 /// <summary>
 /// Logs the method.
 /// </summary>
 /// <param name="section">The section.</param>
 /// <param name="category">The category.</param>
 /// <param name="method">The method.</param>
 /// <param name="parametersNames">The parameters names.</param>
 /// <param name="parametersValue">The parameters value.</param>
 /// <param name="exception">The exception.</param>
 public static void LogMethod(string section, LogCategory category, String method, string parametersNames, object[] parametersValue, Exception exception)
 {
     LogManager.LogMethod(section, category, method, parametersNames.Split(','), parametersValue, exception);
 }
Example #37
0
 public static extern void SDL_LogMessage(
     LogCategory category,
     LogPriority priority,
     /*const char*/ byte *fmt
     //__arglist
     );
Example #38
0
 public static extern LogPriority SDL_LogGetPriority(LogCategory category);
Example #39
0
 public static bool LogCategoryEnabled(LogCategory category)
 {
     return(Trinity.Settings != null && Trinity.Settings.Advanced.LogCategories.HasFlag(category));
 }
 public LogToDebug(LogCategory logCategory)
     : base(logCategory)
 {
 }
 public override void Log(LogCategory category, string message)
 {
     System.Diagnostics.Debug.WriteLine(message);
 }
Example #42
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:StarLightItem"/> class.
 /// </summary>
 /// <param name="origin">The origin.</param>
 /// <param name="text">The text.</param>
 /// <param name="category">The category.</param>
 /// <param name="args">The args.</param>
 public LogItem(string origin, string text, LogCategory category, params object[] args)
 {
     _origin   = origin;
     _text     = String.Format(CultureInfo.CurrentCulture, text, args);
     _category = category;
 }
Example #43
0
 [NotNull] public static Log Create(LogCategory category, string name)
 {
     return(Create((int)category, name));
 }
Example #44
0
 /// <summary>
 /// Logs the method.
 /// </summary>
 /// <param name="section">The section.</param>
 /// <param name="category">The category.</param>
 /// <param name="method">The method.</param>
 /// <param name="parametersNames">The parameters names.</param>
 /// <param name="parametersValue">The parameters value.</param>
 public static void LogMethod(string section, LogCategory category, String method, string[] parametersNames, object[] parametersValue)
 {
     LogManager.LogMethod(section, category, method, parametersNames, parametersValue, null);
 }
Example #45
0
 public LogItem(string message, LogCategory logCategory)
 {
     content  = message;
     category = logCategory;
 }
Example #46
0
 public static void SetLogLevel(LogCategory category, LogLevel level)
 {
     SetLogLevel((int)category, level);
 }
Example #47
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:StarLightItem"/> class.
 /// </summary>
 /// <param name="origin">The origin.</param>
 /// <param name="text">The text.</param>
 /// <param name="category">The category.</param>
 public LogItem(string origin, string text, LogCategory category)
 {
     _origin   = origin;
     _text     = text;
     _category = category;
 }
Example #48
0
 public static LogLevel GetLogLevel(LogCategory category)
 {
     return(GetLogLevel((int)category));
 }
Example #49
0
        public static string AppendLogHeaders(LogCategory level, string message)
        {
            var headerText = "[" + LogHeaders[level] + "] ";

            return(LogHeaderPositionRegex.Replace(message, match => match + headerText));
        }
Example #50
0
 public LogMessage(DateTime Timestamp, string Message, LogCategory Category)
 {
     _timestamp = Timestamp;
     _message   = Message;
     _category  = Category;
 }
Example #51
0
 public void Info(string message, LogCategory category = LogCategory.Apocalypse)
 {
     WriteLog("Info", message, category);
 }
Example #52
0
 public void WriteCritical(LogMessage message, LogCategory category)
 {
     WriteCritical(message, new Collection <LogCategory> {
         category
     });
 }
Example #53
0
 public static extern void LogSetPriority(
     LogCategory category,
     LogPriority priority
     );
Example #54
0
 public void WriteCritical(Exception ex, LogCategory category)
 {
     WriteCritical(ex, new Collection <LogCategory> {
         category
     });
 }
Example #55
0
 public void Log(LogCategory category, string text, params object[] parameters)
 {
     for (int i = 0, LogProvidersCount = LogProviders.Count; i < LogProvidersCount; i++)
     {
         var provider = LogProviders[i];
         provider.Log(category, text, parameters);
     }
 }
Example #56
0
 public override void Log(LogCategory cat, string msg)
 {
     // _data.AppendLine("[Recast:" + cat + "] " + msg);
 }
Example #57
0
 private static extern void INTERNAL_LogCritical(
     LogCategory category,
     byte[] fmtAndArglist
     );
Example #58
0
 /// <summary>
 /// 记录日志
 /// </summary>
 /// <param name="message">日志内容</param>
 /// <param name="category">日志类别</param>
 public static void Log(string message, LogCategory category)
 {
     Log(message, category, LogType.Log);
 }
Example #59
0
 public static extern void SDL_LogSetPriority(LogCategory category, LogPriority level);
Example #60
0
        /// <summary>
        /// Logs the specified section.
        /// </summary>
        /// <param name="section">The section.</param>
        /// <param name="contextClass">The context class.</param>
        /// <param name="contextMethod">The context method.</param>
        /// <param name="category">The category.</param>
        /// <param name="usr">The usr.</param>
        /// <param name="message">The message.</param>
        /// <param name="exception">The exception.</param>
        public static void Log(string section, Type contextClass, string contextMethod, LogCategory category, string usr, string message, Exception exception)
        {
            message = String.Format("Type: [{2}], \n Assembly: [{3}], \n Method: [{4}], \n User: {0}, \n Message: {1}",
                                    usr,
                                    message,
                                    contextClass.FullName,
                                    contextClass.Assembly.FullName,
                                    contextMethod
                                    );

            switch (category)
            {
            case LogCategory.Info:
                log4net.LogManager.GetLogger(section).Info(message, exception);
                break;

            case LogCategory.Warn:
                log4net.LogManager.GetLogger(section).Warn(message, exception);
                break;

            case LogCategory.Debug:
                log4net.LogManager.GetLogger(section).Debug(message, exception);
                break;

            case LogCategory.Error:
                log4net.LogManager.GetLogger(section).Error(message, exception);
                break;

            case LogCategory.Fatal:
                log4net.LogManager.GetLogger(section).Fatal(message, exception);
                break;

            default:
                break;
            }
        }