Which version of Serilog.Sinks.Grafana.Loki are you using?
v8.0.0
Which version of .NET are you using?
net6.0
Describe the bug
I tried to restrict a queue limit using the following code:
ILogger logger = new LoggerConfiguration()
.WriteTo.GrafanaLoki(uri: "https://...",
credentials: new LokiCredentials
{
Login = "...",
Password = "..."
},
labels: new List<LokiLabel>
{
new() {Key = "app", Value = "loki-memory-test"},
new() {Key = "environment", Value = "test"}
},
queueLimit: 10)
.MinimumLevel.Debug()
.CreateLogger();
SelfLog.Enable(Console.Error);
That causes this error to be logged to console:
Caught exception while emitting to sink Serilog.Sinks.Grafana.Loki.LokiSink: System.FormatException: Input string was not in a correct format.
at System.Text.ValueStringBuilder.ThrowFormatError()
at System.Text.ValueStringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ParamsArray args)
at System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args)
at Serilog.Debugging.SelfLog.WriteLine(String format, Object arg0, Object arg1, Object arg2)
at Serilog.Core.Sinks.SafeAggregateSink.Emit(LogEvent logEvent)
If I remove the line "queueLimit: 10", then no such error occurs.
To Reproduce
- Create a console app
- Add Serilog Grafana Loki Nuget package
- Create a logger configuration using code specified in the error description
- Run the app
- Check console output
Expected behavior
Specifying a valid queue limit should not cause System.FormatException
Log/SelfLog output or exception with stacktrace
2022-10-13T14:43:06.3224669Z Caught exception while emitting to sink Serilog.Sinks.Grafana.Loki.LokiSink: System.FormatException: Input string was not in a correct format.
at System.Text.ValueStringBuilder.ThrowFormatError()
at System.Text.ValueStringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ParamsArray args)
at System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args)
at Serilog.Debugging.SelfLog.WriteLine(String format, Object arg0, Object arg1, Object arg2)
at Serilog.Core.Sinks.SafeAggregateSink.Emit(LogEvent logEvent)
Application or code sample, which could be used to reproduce a bug
No response
Additional context
No response
I have read the documentation
Which version of Serilog.Sinks.Grafana.Loki are you using?
v8.0.0
Which version of .NET are you using?
net6.0
Describe the bug
I tried to restrict a queue limit using the following code:
That causes this error to be logged to console:
If I remove the line "queueLimit: 10", then no such error occurs.
To Reproduce
Expected behavior
Specifying a valid queue limit should not cause System.FormatException
Log/SelfLog output or exception with stacktrace
2022-10-13T14:43:06.3224669Z Caught exception while emitting to sink Serilog.Sinks.Grafana.Loki.LokiSink: System.FormatException: Input string was not in a correct format.
at System.Text.ValueStringBuilder.ThrowFormatError()
at System.Text.ValueStringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ParamsArray args)
at System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args)
at Serilog.Debugging.SelfLog.WriteLine(String format, Object arg0, Object arg1, Object arg2)
at Serilog.Core.Sinks.SafeAggregateSink.Emit(LogEvent logEvent)
Application or code sample, which could be used to reproduce a bug
No response
Additional context
No response
I have read the documentation