ILogger ILoggerFactory.GetLogger(string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                name = "default";
            }

            name = name.ToLower();

            if (!_loggers.ContainsKey(name))
            {
                var connectionStringName      = "DefaultConnection";
                var dataAccess                = new LogDbDataAccess(connectionStringName);
                IMessageSerializer serializer = new DefaultMessageSerializer();

                var repository = new DbLogRepository(serializer, dataAccess)
                {
                    NextRepository = new FileLogRepository(serializer, "c:\\FileLogRepository.log")
                    {
                        NextRepository = new ConsoleLogRepository(serializer)
                    }
                };

                var logger = LogMan.NewLogger(l =>
                                              l.Configuration(
                                                  new DbLogConfiguration(connectionStringName, serializer, dataAccess))
                                              .Repository(repository));

                _loggers.Add(name, logger);
            }
            return(_loggers[name]);
        }
Beispiel #2
0
 public static ILogger LogFatal <T>(this T source, object message)
 {
     return(LogMan.GetLogger().Fatal <T>(message));
 }
Beispiel #3
0
 public static ILogScope CreateScope(this object source, string name)
 {
     return(LogMan.NewScope(name));
 }
Beispiel #4
0
 public LogScope(string processName)
     : this(processName, LogMan.GetLogger())
 {
 }