Exemplo n.º 1
0
 public ActorsLogger(ILoggingConfig config, ILogger logger)
 {
     this.enabled         = false;
     this.enabledInConfig = config.ExtraDiagnostics;
     this.path            = config.ExtraDiagnosticsPath.Trim();
     this.log             = logger;
 }
Exemplo n.º 2
0
 /// <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);
		}
Exemplo n.º 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);
 }
Exemplo n.º 5
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();
 }
Exemplo n.º 6
0
 public DefaultConfigImpl(ILoggingConfig baseConfig, Func <string[], ILogger> getLoggerFn)
 {
     if (getLoggerFn == null)
     {
         throw new ArgumentNullException(nameof(getLoggerFn));
     }
     _consoleSemaphore = baseConfig.ConsoleSemaphore;
     _getTsFn          = baseConfig.GetTimestamp;
     _getLoggerFn      = getLoggerFn;
 }
Exemplo n.º 7
0
 public static void InitialiseIfDefault(ILoggingConfig config)
 {
     if (config == null)
     {
         throw new ArgumentNullException(nameof(config));
     }
     if (_config.Item2 == 1u)
     {
         Initialise(config);
     }
 }
Exemplo n.º 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;
 }
Exemplo n.º 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();
        }
Exemplo n.º 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();
        }
Exemplo n.º 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;
        }
Exemplo n.º 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");
     }
 }
Exemplo n.º 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) {}
Exemplo n.º 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}\"]"
     );
Exemplo n.º 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)
 {
 }
Exemplo n.º 17
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>
 public LoggingInterceptor(ILoggingConfig config, Func<Type, ILog> logFactory)
     : this(config, logFactory, null)
 {
 }
Exemplo n.º 18
0
        // 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));
        }