Exemple #1
0
        public NlogContextRunner(NlogContextRunnerConfig config)
        {
            _config = config;

            OnStart    = Setup;
            Sanitizers = _config?.SanitizedProperties != null && _config.SanitizedProperties.Length > 0
                ? new[] { new KeyBasedSanitizer(_config.SanitizedProperties) }
                : new[] { new KeyBasedSanitizer(new string[0]) };
        }
Exemple #2
0
        public NlogContextRunner(IOptionsMonitor <NlogContextRunnerConfig> options)
        {
            _config = options.CurrentValue;

            OnStart    = Setup;
            Sanitizers = _config?.SanitizedProperties != null && _config.SanitizedProperties.Length > 0
                ? new[] { new KeyBasedSanitizer(_config.SanitizedProperties) }
                : new[] { new KeyBasedSanitizer(new string[0]) };
        }
Exemple #3
0
        public NlogContextRunner(NlogContextRunnerConfig config)
        {
            _config           = config;
            _memoryLogService = new MemoryLogService(config);

            var maxDepth = config?.MaxSanitizerDepth ?? 10;

            OnStart    = Setup;
            OnEnd      = Teardown;
            Settings   = GetActionContextSettings();
            Sanitizers = _config?.SanitizedProperties != null && _config.SanitizedProperties.Length > 0
                ? new[] { new KeyBasedSanitizer(_config.SanitizedProperties, maxDepth) }
                : new[] { new KeyBasedSanitizer(new string[0]) };
        }
 public static void Configure(NlogContextRunnerConfig config)
 {
     Runner = new NlogContextRunner(config);
 }