-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathIDaprLogger.cs
47 lines (42 loc) · 2.26 KB
/
IDaprLogger.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#pragma warning disable SA1618 // Generic type parameters should be documented
// Based on https://github.com/dotnet/extensions/blob/release/2.1/src/Logging/Logging.Abstractions/src/ILogger.cs
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See NET_EXTENSIONS_LICENSE in this directory for license information.
using System;
namespace Man.Dapr.Sidekick.Logging
{
public interface IDaprLogger
{
/// <summary>
/// Writes a log entry.
/// </summary>
/// <param name="logLevel">Entry will be written on this level.</param>
/// <param name="eventId">Id of the event.</param>
/// <param name="state">The entry to be written. Can be also an object.</param>
/// <param name="exception">The exception related to this entry.</param>
/// <param name="formatter">Function to create a <c>string</c> message of the <paramref name="state"/> and <paramref name="exception"/>.</param>
void Log<TState>(DaprLogLevel logLevel, DaprEventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter);
/// <summary>
/// Checks if the given <paramref name="logLevel"/> is enabled.
/// </summary>
/// <param name="logLevel">level to be checked.</param>
/// <returns><c>true</c> if enabled.</returns>
bool IsEnabled(DaprLogLevel logLevel);
/// <summary>
/// Begins a logical operation scope.
/// </summary>
/// <param name="state">The identifier for the scope.</param>
/// <returns>An IDisposable that ends the logical operation scope on dispose.</returns>
IDisposable BeginScope<TState>(TState state);
}
/// <summary>
/// A generic interface for logging where the category name is derived from the specified
/// <typeparamref name="TCategoryName"/> type name.
/// Generally used to enable activation of a named <see cref="IDaprLogger"/> from dependency injection.
/// </summary>
/// <typeparam name="TCategoryName">The type who's name is used for the logger category name.</typeparam>
public interface IDaprLogger<out TCategoryName> : IDaprLogger
{
}
}
#pragma warning restore SA1618 // Generic type parameters should be documented