Ejemplo n.º 1
0
        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);
                    }
                }
            }
        }
Ejemplo n.º 2
0
 public virtual void Write(Entry entry, IFormatter formatter)
 {
     var content = (Formatter ?? formatter).Format(entry);
     Write(content);
 }