示例#1
0
 public ActorsLogger(ILoggingConfig config, ILogger logger)
 {
     this.enabled         = false;
     this.enabledInConfig = config.ExtraDiagnostics;
     this.path            = config.ExtraDiagnosticsPath.Trim();
     this.log             = logger;
 }
示例#2
0
文件: Facade.cs 项目: wushian/logary
 /// <summary>
 /// Initialise the Logary facade globally.
 /// </summary>
 /// <param name="config"></param>
 public static void Initialise(ILoggingConfig config)
 {
     if (config == null)
     {
         throw new ArgumentNullException(nameof(config));
     }
     _config = Tuple.Create(config, _config.Item2 + 1u);
 }
		/// <summary>
		///    Initializes a new instance of the <see cref="LoggingInterceptor" /> class.
		/// </summary>
		/// <param name="config">The config.</param>
		/// <param name="logFactory">The log factory.</param>
		/// <param name="formatter">The formatter.</param>
		/// <param name="condition">The intercept condition.</param>
		public LoggingInterceptor(ILoggingConfig config, Func<Type, ILog> logFactory, ILogValueFormatter formatter,
			Func<IInvocation, bool> condition)
		{
			_logFactory = logFactory;
			_formatter = formatter;
			_config = config;
			Initialize(condition);
		}
示例#4
0
 /// <summary>
 ///    Initializes a new instance of the <see cref="LoggingInterceptor" /> class.
 /// </summary>
 /// <param name="config">The config.</param>
 /// <param name="logFactory">The log factory.</param>
 /// <param name="formatter">The formatter.</param>
 /// <param name="condition">The intercept condition.</param>
 public LoggingInterceptor(ILoggingConfig config, Func <Type, ILog> logFactory, ILogValueFormatter formatter,
                           Func <IInvocation, bool> condition)
 {
     _logFactory = logFactory;
     _formatter  = formatter;
     _config     = config;
     Initialize(condition);
 }
 public Logger(string processId, ILoggingConfig config)
 {
     this.processId         = processId;
     this.priorityThreshold = config.LogLevel;
     this.logProcessId      = config.LogProcessId;
     this.dateFormat        = config.DateFormat;
     this.fileLock          = new object();
 }
示例#6
0
文件: Facade.cs 项目: wushian/logary
 public DefaultConfigImpl(ILoggingConfig baseConfig, Func <string[], ILogger> getLoggerFn)
 {
     if (getLoggerFn == null)
     {
         throw new ArgumentNullException(nameof(getLoggerFn));
     }
     _consoleSemaphore = baseConfig.ConsoleSemaphore;
     _getTsFn          = baseConfig.GetTimestamp;
     _getLoggerFn      = getLoggerFn;
 }
示例#7
0
文件: Facade.cs 项目: wushian/logary
 public static void InitialiseIfDefault(ILoggingConfig config)
 {
     if (config == null)
     {
         throw new ArgumentNullException(nameof(config));
     }
     if (_config.Item2 == 1u)
     {
         Initialise(config);
     }
 }
示例#8
0
 public Logger(string processId, ILoggingConfig config)
 {
     this.processId             = processId;
     this.priorityThreshold     = config.LogLevel;
     this.logProcessId          = config.LogProcessId;
     this.dateFormat            = config.DateFormat;
     this.fileLock              = new object();
     this.debuggingBuffer       = new Queue <string>();
     this.debuggingBufferLength = config.DebuggingLogBufferLength;
     this.useDebuggingBuffer    = this.debuggingBufferLength > 0;
 }
示例#9
0
        public CombinedLogsUserControl(
            [NotNull] ILogMessageSteam logMessageSteam,
            [NotNull] ILoggingConfig loggingConfig,
            [NotNull] IProcessStarter processStarter,
            [NotNull] IUserNotifier userNotifier,
            [NotNull] ISendBugReportViewFactory sendBugReportViewFactory)
        {
            if (logMessageSteam == null)
            {
                throw new ArgumentNullException(nameof(logMessageSteam));
            }
            if (loggingConfig == null)
            {
                throw new ArgumentNullException(nameof(loggingConfig));
            }
            if (processStarter == null)
            {
                throw new ArgumentNullException(nameof(processStarter));
            }
            if (userNotifier == null)
            {
                throw new ArgumentNullException(nameof(userNotifier));
            }
            if (sendBugReportViewFactory == null)
            {
                throw new ArgumentNullException(nameof(sendBugReportViewFactory));
            }

            this.logMessageSteam          = logMessageSteam;
            this.loggingConfig            = loggingConfig;
            this.processStarter           = processStarter;
            this.userNotifier             = userNotifier;
            this.sendBugReportViewFactory = sendBugReportViewFactory;

            InitializeComponent();

            logMessageSteam.EventLogged       += LogMessagePublisherOnEventLogged;
            logMessageSteam.ErrorCountChanged += LogMessagePublisherOnErrorCountChanged;

            var missedEvents = logMessageSteam.ConsumeMissedMessages();

            foreach (var missedEvent in missedEvents)
            {
                LogMessagePublisherOnEventLogged(logMessageSteam, missedEvent);
            }

            timer.Enabled = true;

            RecalculateErrors();
        }
示例#10
0
        public Logger(string processId, ILoggingConfig config)
        {
            this.processId         = processId;
            this.priorityThreshold = config.LogLevel;
            this.logProcessId      = config.LogProcessId;
            this.dateFormat        = config.DateFormat;

            this.blackList = config.BlackList;
            this.whiteList = config.WhiteList;

            this.blackListEnabled = this.blackList.Count > 0;
            this.whiteListEnabled = this.whiteList.Count > 0;
            this.bwEnabled        = this.blackListEnabled || this.whiteListEnabled;

            this.fileLock = new object();
        }
示例#11
0
        public Logger(string processId, ILoggingConfig config)
        {
            this.processId         = processId;
            this.priorityThreshold = config.LogLevel;
            this.logProcessId      = config.LogProcessId;
            this.dateFormat        = config.DateFormat;
            this.fileLock          = new object();

            this.blackList = config.BlackList
                             .Where(s => !string.IsNullOrEmpty(s))
                             .Select(s => s.ToLowerInvariant()).ToImmutableHashSet();

            this.whiteList = config.WhiteList
                             .Where(s => !string.IsNullOrEmpty(s))
                             .Select(s => s.ToLowerInvariant()).ToImmutableHashSet();
            this.onlyWhiteListed = this.whiteList.Count > 0;
        }
示例#12
0
 public Logger(ILoggingConfig config)
 {
     desiredLogLevel = config.LogLevel;
     if (string.IsNullOrEmpty(config.NlogConfigFileName))
     {
         loggerFactory       = new LogFactory();
         variableLogger      = loggerFactory.GetLogger("customLogger");
         variableErrorLogger = loggerFactory.GetLogger("customErrorLogger");
     }
     else
     {
         var normalizer = new PathNormalizer();
         var serverPath = normalizer.Normalize(config.NlogConfigFileName);
         loggerFactory       = new LogFactory(new XmlLoggingConfiguration(serverPath));
         variableLogger      = loggerFactory.GetLogger("messageLogger");
         variableErrorLogger = loggerFactory.GetLogger("errorLogger");
     }
 }
示例#13
0
        public Logger(string processId, ILoggingConfig config)
        {
            this.processId    = processId;
            this.logLevel     = config.LogLevel;
            this.logProcessId = config.LogProcessId;
            this.dateFormat   = config.DateFormat;

            this.blackList = config.BlackList;
            this.whiteList = config.WhiteList;

            this.blackListEnabled = this.blackList.Count > 0;
            this.whiteListEnabled = this.whiteList.Count > 0;
            this.bwEnabled        = this.blackListEnabled || this.whiteListEnabled;

            this.bwPrefixUsed       = !string.IsNullOrEmpty(config.BwListPrefix);
            this.bwListPrefix       = config.BwListPrefix;
            this.bwListPrefixLength = config.BwListPrefix.Length;

            this.fileLock = new object();
        }
		/// <summary>
		///    Initializes a new instance of the <see cref="LoggingInterceptor" /> class.
		/// </summary>
		/// <param name="config">The config.</param>
		/// <param name="logFactory">The log factory.</param>
		/// <param name="formatter">The formatter.</param>
		public LoggingInterceptor(ILoggingConfig config, Func<Type, ILog> logFactory, ILogValueFormatter formatter)
			: this(config, logFactory, formatter, null) {}
示例#15
0
 /// <summary>
 /// Creates a <see cref="Config"/> from an <see cref="ILoggingConfig"/> object
 /// </summary>
 /// <param name="cfg">The <see cref="ILoggingConfig"/></param>
 /// <returns><see cref="Config"/></returns>
 public static Config CreateLoggingConfig(ILoggingConfig cfg)
 => ConfigurationFactory
 .ParseString(
     $"akka.loglevel = {cfg.LogLevel}, akka.loggers = [\"{cfg.LoggerClassName}, {cfg.LoggerBinaryName}\"]"
     );
示例#16
0
 /// <summary>
 ///    Initializes a new instance of the <see cref="LoggingInterceptor" /> class.
 /// </summary>
 /// <param name="config">The config.</param>
 /// <param name="logFactory">The log factory.</param>
 /// <param name="formatter">The formatter.</param>
 public LoggingInterceptor(ILoggingConfig config, Func <Type, ILog> logFactory, ILogValueFormatter formatter)
     : this(config, logFactory, formatter, null)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="LoggingInterceptor"/> class.
 /// </summary>
 /// <param name="config">The config.</param>
 /// <param name="logFactory">The log factory.</param>
 public LoggingInterceptor(ILoggingConfig config, Func<Type, ILog> logFactory)
     : this(config, logFactory, null)
 {
 }
示例#18
0
文件: Facade.cs 项目: wushian/logary
        // helpers for updating the configuration

        /// <summary>
        /// Change the implementation of GetLogger to the passed Func.
        /// </summary>
        public static ILoggingConfig WithGetLogger(this ILoggingConfig me, Func <string[], ILogger> getLoggerFn)
        {
            return(new DefaultConfigImpl(me, getLoggerFn));
        }