Skip to content

Commit

Permalink
add CreateLog extension method
Browse files Browse the repository at this point in the history
  • Loading branch information
kuznetsov.as committed Aug 29, 2023
1 parent 86fb902 commit 9c2874f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions Vostok.Logging.Microsoft/PublicAPI.Shipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const Vostok.Logging.Microsoft.Helpers.MicrosoftLogScopes.HostingLogScopeOld = "
const Vostok.Logging.Microsoft.Helpers.MicrosoftLogScopes.ViewComponentLogScope = "Microsoft.AspNetCore.Mvc.ViewFeatures.MvcViewFeaturesLoggerExtensions+ViewComponentLogScope" -> string
static Vostok.Logging.Microsoft.VostokLoggerExtensions.AddVostok(this Microsoft.Extensions.Logging.ILoggerFactory factory, Vostok.Logging.Abstractions.ILog log) -> Microsoft.Extensions.Logging.ILoggerFactory
static Vostok.Logging.Microsoft.VostokLoggerExtensions.AddVostok(this Microsoft.Extensions.Logging.ILoggingBuilder builder, Vostok.Logging.Abstractions.ILog log) -> Microsoft.Extensions.Logging.ILoggingBuilder
static Vostok.Logging.Microsoft.VostokLoggerExtensions.CreateLog(this Microsoft.Extensions.Logging.ILoggerFactory factory, string categoryName) -> Vostok.Logging.Microsoft.MicrosoftLog
Vostok.Logging.Microsoft.Helpers.MicrosoftLogScopes
Vostok.Logging.Microsoft.MicrosoftLog
Vostok.Logging.Microsoft.MicrosoftLog.ForContext(string context) -> Vostok.Logging.Abstractions.ILog
Expand Down
10 changes: 10 additions & 0 deletions Vostok.Logging.Microsoft/VostokLoggerExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,15 @@ public static ILoggingBuilder AddVostok([NotNull] this ILoggingBuilder builder,
builder.AddProvider(new VostokLoggerProvider(log));
return builder;
}

/// <summary>
/// <para>Create a new <see cref="MicrosoftLog"/> with given <paramref name="categoryName"/> from the <paramref name="factory"/></para>
/// </summary>
[NotNull]
public static MicrosoftLog CreateLog([NotNull] this ILoggerFactory factory, string categoryName)
{
var logger = factory.CreateLogger(categoryName);
return new MicrosoftLog(logger);
}
}
}

0 comments on commit 9c2874f

Please sign in to comment.