Updates to Elastic logging
This commit is contained in:
@@ -9,9 +9,10 @@ namespace PluralKit.Core
|
||||
public string InfluxUrl { get; set; }
|
||||
public string InfluxDb { get; set; }
|
||||
public string LogDir { get; set; }
|
||||
public string ElasticUrl { get; set; }
|
||||
public string? ElasticUrl { get; set; }
|
||||
|
||||
public LogEventLevel ConsoleLogLevel { get; set; } = LogEventLevel.Debug;
|
||||
public LogEventLevel ElasticLogLevel { get; set; } = LogEventLevel.Information;
|
||||
public LogEventLevel FileLogLevel { get; set; } = LogEventLevel.Information;
|
||||
}
|
||||
}
|
@@ -33,7 +33,7 @@ namespace PluralKit.Core
|
||||
_config = config;
|
||||
_countHolder = countHolder;
|
||||
_metrics = metrics;
|
||||
_logger = logger;
|
||||
_logger = logger.ForContext<Database>();
|
||||
|
||||
_connectionString = new NpgsqlConnectionStringBuilder(_config.Database)
|
||||
{
|
||||
|
@@ -8,8 +8,7 @@ namespace PluralKit.Core
|
||||
|
||||
public ModelRepository(ILogger logger)
|
||||
{
|
||||
_logger = logger.ForContext<ILogger>()
|
||||
.ForContext("Elastic", "yes?");
|
||||
_logger = logger.ForContext<ModelRepository>();
|
||||
}
|
||||
}
|
||||
}
|
@@ -52,7 +52,6 @@ namespace PluralKit.Core
|
||||
|
||||
// Don't want App.Metrics/D#+ spam
|
||||
.MinimumLevel.Override("App.Metrics", LogEventLevel.Information)
|
||||
.MinimumLevel.Override("DSharpPlus", LogEventLevel.Debug)
|
||||
|
||||
// Actual formatting for these is handled in ScalarFormatting
|
||||
.Destructure.AsScalar<SystemId>()
|
||||
@@ -98,14 +97,12 @@ namespace PluralKit.Core
|
||||
{
|
||||
AutoRegisterTemplate = true,
|
||||
AutoRegisterTemplateVersion = AutoRegisterTemplateVersion.ESv7,
|
||||
MinimumLogEventLevel = LogEventLevel.Verbose,
|
||||
MinimumLogEventLevel = config.ElasticLogLevel,
|
||||
IndexFormat = "pluralkit-logs-{0:yyyy.MM.dd}",
|
||||
CustomFormatter = new ScalarFormatting.Elasticsearch()
|
||||
CustomFormatter = new ScalarFormatting.Elasticsearch(),
|
||||
};
|
||||
|
||||
logCfg.WriteTo
|
||||
.Conditional(e => e.Properties.ContainsKey("Elastic"),
|
||||
c => c.Elasticsearch(elasticConfig));
|
||||
|
||||
logCfg.WriteTo.Elasticsearch(elasticConfig);
|
||||
}
|
||||
|
||||
_fn.Invoke(logCfg);
|
||||
|
Reference in New Issue
Block a user