示例#1
0
文件: Logger.cs 项目: pifarik/XLog
        private void LogInternal(LogLevel logLevel, string message, long category, Exception ex)
        {
            if (!_config.IsEnabled || !_config.Levels[(int)logLevel])
            {
                return;
            }

            var entry = new Entry(logLevel, Tag, message, category, ex);
            for (int index = 0; index < _config.TargetConfigs.Count; index++)
            {
                var c = _config.TargetConfigs[index];
                if (c.SupportsLevel(logLevel))
                {
                    try
                    {
                        c.Target.Write(entry, _config.Formatter);
                    }
                    catch (Exception e)
                    {
                        System.Diagnostics.Debug.WriteLine("Target write failed. --> {0}", e);
                    }
                }
            }
        }
示例#2
0
文件: Target.cs 项目: Belorus/XLog
 public virtual void Write(Entry entry, IFormatter formatter)
 {
     var content = (Formatter ?? formatter).Format(entry);
     Write(content);
 }