Skip to content

Commit a41d6fd

Browse files
authored
Merge pull request #51 from karol-dubas/fix/scalar-value-cast-convert
Fixed ScalarValue boxed cast exception for short, ushort and byte
2 parents 993ccfa + 32d7f53 commit a41d6fd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Serilog.Sinks.Loki/Internal/ScalarValueFormattingExtensions.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This file is part of the project licensed under the MIT License.
1+
// This file is part of the project licensed under the MIT License.
22
// See the LICENSE file in the project root for more information.
33

44

@@ -23,10 +23,12 @@ internal static void WriteAsValue(this ScalarValue scalarValue, Utf8JsonWriter w
2323

2424
switch (value)
2525
{
26-
case int:
2726
case short:
2827
case ushort:
2928
case byte:
29+
writer.WriteNumberValue(Convert.ToInt32(value));
30+
break;
31+
case int:
3032
writer.WriteNumberValue((int)value);
3133
break;
3234
case uint:

0 commit comments

Comments
 (0)