Replies: 2 comments 5 replies
-
The provided link is not a working code sample, as it is missing the format string and the arguments to |
Beta Was this translation helpful? Give feedback.
3 replies
-
var player = new { Name = "Joe", SteamID = 1234, IP = "127.0.0.1" };
var now = DateTime.Now.ToString(CultureInfo.InvariantCulture);
var arg = new { player, now };
var format = "[{now}] [-] {player.Name} ({player.SteamID})) [{player.IP}]";
var result = Smart.Format(format, arg);
// "[09/02/2023 08:58:07] [-] Joe (1234)) [127.0.0.1]"
//
// or
//
format = "[{0}] [-] {1.Name} ({1.SteamID})) [{1.IP}]";
result = Smart.Format(format, now, player);
// [09/02/2023 09:02:01] [-] Joe (1234)) [127.0.0.1] |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
axunonb
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi! Thanks for reporting this bug!
Please fill in the relevant information from this template so that we can help you best.
Smart.Format version: 3.2.2
Framework version: (e.g. net5.0) net6
Please provide a working source code example to reproduce the bug
https://github.com/Bluscream/battlebitapirunner-modules/blob/f706b53ef15d943ddcc7697ec566e90c1e16b4b9/modules/Logger.cs#L118
What is the current result?
Crash
What is the expected result?
formatted DateTime.Now
Please post full exception details if applicable (message, stacktrace, inner exceptions)
no
not that i know of
what?
Beta Was this translation helpful? Give feedback.
All reactions