You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 5, 2019. It is now read-only.
If I can make a suggestion - it is rather useful to have a version of the logging methods with this signature and implementation:
public static void Debug<T>(this ILog logger, T message)
{
if (logger.IsDebugEnabled())
{
logger.Log(LogLevel.Debug, message?.ToString().AsFunc());
}
}
This allows logging of custom objects without boxing / allocating a closure / allocating a delegate / unnecessarily executing ToString() if the log isn't enabled.
I find it is also nice to have some overloads for the methods with params object[] parameters for calls with less than a few params to avoid the array allocation in those cases.
For most cases this won't be significant of course, but those allocations can really add up with tracing level calls.
The text was updated successfully, but these errors were encountered:
This feature would be super useful. We have some custom hooks which fill in some additional metadata depending on the type of message, so sending some object through to the logging library would help us a lot,
I had a look at the logging libraries that LibLog currently supports and it seems like all of them accept either object or have a generic function like Debug<T>(T message) to get any type of message logged.
If I can make a suggestion - it is rather useful to have a version of the logging methods with this signature and implementation:
This allows logging of custom objects without boxing / allocating a closure / allocating a delegate / unnecessarily executing
ToString()
if the log isn't enabled.I find it is also nice to have some overloads for the methods with
params object[]
parameters for calls with less than a few params to avoid the array allocation in those cases.For most cases this won't be significant of course, but those allocations can really add up with tracing level calls.
The text was updated successfully, but these errors were encountered: