Skip to content

Commit 84c27ad

Browse files
committed
Updating LibLog again
1 parent 63cd12e commit 84c27ad

24 files changed

+5131
-26
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
namespace WampSharp.Logging
2+
{
3+
using System;
4+
5+
/// <summary>
6+
/// Simple interface that represent a logger.
7+
/// </summary>
8+
#if LIBLOG_PUBLIC
9+
public
10+
#else
11+
internal
12+
#endif
13+
interface ILog
14+
{
15+
/// <summary>
16+
/// Log a message the specified log level.
17+
/// </summary>
18+
/// <param name="logLevel">The log level.</param>
19+
/// <param name="messageFunc">The message function.</param>
20+
/// <param name="exception">An optional exception.</param>
21+
/// <param name="formatParameters">Optional format parameters for the message generated by the messagefunc. </param>
22+
/// <returns>true if the message was logged. Otherwise false.</returns>
23+
/// <remarks>
24+
/// Note to implementers: the message func should not be called if the loglevel is not enabled
25+
/// so as not to incur performance penalties.
26+
/// To check IsEnabled call Log with only LogLevel and check the return value, no event will be written.
27+
/// </remarks>
28+
bool Log(LogLevel logLevel, Func<string> messageFunc, Exception exception = null,
29+
params object[] formatParameters);
30+
}
31+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
5+
namespace WampSharp.Logging
6+
{
7+
/// <summary>
8+
/// Represents a way to get a <see cref="ILog"/>
9+
/// </summary>
10+
#if LIBLOG_PROVIDERS_ONLY
11+
internal
12+
#else
13+
public
14+
#endif
15+
interface ILogProvider
16+
{
17+
/// <summary>
18+
/// Gets the specified named logger.
19+
/// </summary>
20+
/// <param name="name">Name of the logger.</param>
21+
/// <returns>The logger reference.</returns>
22+
Logger GetLogger(string name);
23+
24+
/// <summary>
25+
/// Opens a nested diagnostics context. Not supported in EntLib logging.
26+
/// </summary>
27+
/// <param name="message">The message to add to the diagnostics context.</param>
28+
/// <returns>A disposable that when disposed removes the message from the context.</returns>
29+
IDisposable OpenNestedContext(string message);
30+
31+
/// <summary>
32+
/// Opens a mapped diagnostics context. Not supported in EntLib logging.
33+
/// </summary>
34+
/// <param name="key">A key.</param>
35+
/// <param name="value">A value.</param>
36+
/// <returns>A disposable that when disposed removes the map from the context.</returns>
37+
IDisposable OpenMappedContext(string key, object value, bool destructure = false);
38+
}
39+
}

0 commit comments

Comments
 (0)