-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMultiLogger.cs
48 lines (40 loc) · 1.29 KB
/
MultiLogger.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
48
using RSG.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace RSG
{
/// <summary>
/// Forwards log messages to multiple destinations.
/// </summary>
public class MultiLogger : ILogger
{
private ILogger[] destLoggers;
public MultiLogger(params ILogger[] destLoggers)
{
Argument.NotNull(() => destLoggers);
this.destLoggers = destLoggers;
}
public void LogError(Exception ex, string message, params object[] args)
{
destLoggers.Each(log => log.LogError(ex, message, args));
}
public void LogError(string message, params object[] args)
{
destLoggers.Each(log => log.LogError(message, args));
}
public void LogInfo(string message, params object[] args)
{
destLoggers.Each(log => log.LogInfo(message, args));
}
public void LogVerbose(string message, params object[] args)
{
destLoggers.Each(log => log.LogVerbose(message, args));
}
public void LogWarning(string message, params object[] args)
{
destLoggers.Each(log => log.LogWarning(message, args));
}
}
}