C
C#2y ago
CrosRoad95

❔ Serilog

Let's say i have a following log: Logger.Information("You have earn {amount}{currency}", 10, "$") can i make a currency is only text formated and no label being created? i don't want useless labels be exported to for example seq ping me if you know
6 Replies
Anton
Anton2y ago
Just format it in place I guess
string str = string.Format(same_thing);
Logger.Information(str);
string str = string.Format(same_thing);
Logger.Information(str);
Of course, this would always allocate the string, whether the message would be printed or not Ah nevermind
Anton
Anton2y ago
GitHub
Structured Data · serilog/serilog Wiki
Simple .NET logging with fully-structured events. Contribute to serilog/serilog development by creating an account on GitHub.
Anton
Anton2y ago
It's simpler
CrosRoad95
CrosRoad952y ago
so i should make {@currency}
Jayy
Jayy2y ago
jsut use string interpolation then theres no reason to use serilog if you dont want structured logs lol
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts
❔ proceduresHow do I declare a procedure or a function, I'm in a lesson but they only showed me how to do it in ✅ Consuming REST API in MAUII'm pretty new to MAUI and I want to make an app that gets some data from a REST API and presents itHelp refactor please? I might have missed something big here [Answered]is there maybe a better way of writing this? ```cs foreach (Experience experience in User.Profile.Ex❔ Models data is not showing in view with help of ViewDataI have created model and passed its data with ViewData like this- Controller Code--> IEnumerable<Se✅ Software architecture for front-end translationsI've an .NET 7 Blazor WebAssembly Hosted web application meant to be deployed in a industrial enviro❔ Help with designing a functional container objectHi, I could use some input for a functional container/result object I'm working on. I want it (the s❔ Enumerable.Current is not null in debug mode but assigns null to variableI know I'm not exactly following the best practices with the reader but this code should work none tJSON Array to build a complex object isn't letting me create multiple different properties inside itHi! I'm having an issue serializing a JSON object to create a Microsoft Band WebTile. Here is my cod❔ Proper mocking for Unit Testing (NUnit)```csharp public class TargetServiceSetEndDateAsTwoMonthsOut : PreProcessorAction<CreateTargetServic❔ My code repeats my menu everytime a invalid character is added - i want to display a error messageMy menu works but I want to display a error message if the user enters a invalid character. I was t