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
Logging doesn't appear to work (at least for me). From what I can see LoggerProvider creates its own LoggerFactory with which there is no access to be able to add providers. If I am mistaken here please forgive me and let me know if there's a way to set-up those providers.
Otherwise can I suggest adding a public static method to inject one's own ILoggerFactory? For example:
usingMicrosoft.Extensions.Logging;namespaceBanzai.Logging{/// <summary>/// Provides loggers via the static LoggerFactory to the rest of the application/// </summary>publicstaticclassLoggerProvider{/// <summary>/// Adds existing logger factory./// </summary>/// <param name="loggerFactory"></param>publicstaticvoidAddLoggerFactory(ILoggerFactoryloggerFactory){LoggerFactory=loggerFactory;}privatestaticILoggerFactoryLoggerFactory{get;set;}=newLoggerFactory();/// <summary>/// Creates a logger for the given type./// </summary>/// <typeparam name="T">The type for which to a logger is created.</typeparam>/// <returns>The requested logger.</returns>publicstaticILoggerCreateLogger<T>(){returnLoggerFactory.CreateLogger<T>();}/// <summary>/// Creates a logger for the given instance type./// </summary>/// <typeparam name="T">The type for which to a logger is created.</typeparam>/// <param name="instance">The instance used to derive a type for which a logger is created.</param>/// <returns>The requested logger.</returns>publicstaticILoggerCreateLogger<T>(Tinstance){returnLoggerFactory.CreateLogger(instance.GetType());}}}
The text was updated successfully, but these errors were encountered:
Logging doesn't appear to work (at least for me). From what I can see
LoggerProvider
creates its ownLoggerFactory
with which there is no access to be able to add providers. If I am mistaken here please forgive me and let me know if there's a way to set-up those providers.Otherwise can I suggest adding a public static method to inject one's own
ILoggerFactory
? For example:The text was updated successfully, but these errors were encountered: