public static ILogger CreateCurrentClassLogger(this ILoggerFactory loggerFactory)
            var frame = new StackFrame(1, false);

            string loggerName = frame.GetMethod().DeclaringType.FullName;

            return loggerFactory.CreateLogger(loggerName);
 /// <summary>
 /// Captures synchronous and asynchronous exceptions from the pipeline and generates HTML error responses.
 /// Full error details are only displayed by default if 'host.AppMode' is set to 'development' in the IAppBuilder.Properties.
 /// </summary>
 /// <param name="builder"></param>
 /// <param name="options"></param>
 /// <returns></returns>
 public static IAppBuilder UseErrorPage(this IAppBuilder builder, ErrorPageOptions options)
     if (builder == null)
         throw new ArgumentNullException("builder");
     string appMode = new AppProperties(builder.Properties).Get<string>(Constants.HostAppMode);
     bool isDevMode = string.Equals(Constants.DevMode, appMode, StringComparison.Ordinal);
     ILogger logger = builder.CreateLogger<ErrorPageMiddleware>();
     return builder.Use<ErrorPageMiddleware>(options, logger, isDevMode);
 public static ILogger CreateCommandsLogger(this ILoggerProvider loggerProvider)
     => loggerProvider.CreateLogger(CommandsLoggerName);
 public static ILogger CreateCommandsLogger(this ILoggerFactory loggerFactory)
     => loggerFactory.CreateLogger(CommandsLoggerName);
 public static ILogger Create(this ILoggerFactory source, Func<ILoggerFactoryExtension, Func<string>> name) {
     return source.CreateLogger(name(null)());
 public static ILogger CreateLogger(this ILoggerFactory source, Func<ILoggerFactory, Func<string>> name) {
     return source.CreateLogger(name(source)());
Example #7
 public static Logger ChildLogger(this Logger logger, String childLoggerName)
     if (logger != null)
         return logger.CreateLogger(childLoggerName);
     return null;