3
3
4
4
namespace NHibernate . Example . Web . Infrastructure
5
5
{
6
- public class NHibernateToMicrosoftLogger : IInternalLogger
6
+ public class NHibernateToMicrosoftLogger : IInternalLogger2
7
7
{
8
8
private readonly ILogger _msLogger ;
9
9
@@ -12,116 +12,79 @@ public NHibernateToMicrosoftLogger(ILogger msLogger)
12
12
_msLogger = msLogger ?? throw new ArgumentNullException ( nameof ( msLogger ) ) ;
13
13
}
14
14
15
- public void Error ( object message )
15
+ public void Fatal ( Exception exception , string format , params object [ ] args )
16
16
{
17
- if ( IsErrorEnabled )
18
- {
19
- _msLogger . LogError ( message . ToString ( ) ) ;
20
- }
17
+ _msLogger . LogCritical ( exception , format , args ) ;
21
18
}
22
19
23
- public void Error ( object message , Exception exception )
20
+ public void Fatal ( string format , params object [ ] args )
24
21
{
25
- if ( IsErrorEnabled )
26
- {
27
- _msLogger . LogError ( exception , message . ToString ( ) ) ;
28
- }
22
+ _msLogger . LogCritical ( format , args ) ;
29
23
}
30
24
31
- public void ErrorFormat ( string format , params object [ ] args )
25
+ public void Error ( Exception exception , string format , params object [ ] args )
32
26
{
33
- if ( IsErrorEnabled )
34
- {
35
- _msLogger . LogError ( format , args ) ;
36
- }
27
+ _msLogger . LogError ( exception , format , args ) ;
37
28
}
38
29
39
- public void Fatal ( object message )
30
+ public void Error ( string format , params object [ ] args )
40
31
{
41
- if ( IsFatalEnabled )
42
- {
43
- _msLogger . LogCritical ( message . ToString ( ) ) ;
44
- }
32
+ _msLogger . LogError ( format , args ) ;
45
33
}
46
34
47
- public void Fatal ( object message , Exception exception )
35
+ public void Warn ( Exception exception , string format , params object [ ] args )
48
36
{
49
- if ( IsFatalEnabled )
50
- {
51
- _msLogger . LogCritical ( exception , message . ToString ( ) ) ;
52
- }
37
+ _msLogger . LogWarning ( exception , format , args ) ;
53
38
}
54
39
55
- public void Debug ( object message )
40
+ public void Warn ( string format , params object [ ] args )
56
41
{
57
- if ( IsDebugEnabled )
58
- {
59
- _msLogger . LogDebug ( message . ToString ( ) ) ;
60
- }
42
+ _msLogger . LogWarning ( format , args ) ;
61
43
}
62
44
63
- public void Debug ( object message , Exception exception )
45
+ public void Info ( Exception exception , string format , params object [ ] args )
64
46
{
65
- if ( IsDebugEnabled )
66
- {
67
- _msLogger . LogDebug ( exception , message . ToString ( ) ) ;
68
- }
47
+ _msLogger . LogInformation ( exception , format , args ) ;
69
48
}
70
49
71
- public void DebugFormat ( string format , params object [ ] args )
50
+ public void Info ( string format , params object [ ] args )
72
51
{
73
- if ( IsDebugEnabled )
74
- {
75
- _msLogger . LogDebug ( format , args ) ;
76
- }
52
+ _msLogger . LogInformation ( format , args ) ;
77
53
}
78
54
79
- public void Info ( object message )
55
+ public void Debug ( Exception exception , string format , params object [ ] args )
80
56
{
81
- if ( IsInfoEnabled )
82
- {
83
- _msLogger . LogInformation ( message . ToString ( ) ) ;
84
- }
57
+ _msLogger . LogDebug ( exception , format , args ) ;
85
58
}
86
59
87
- public void Info ( object message , Exception exception )
60
+ public void Debug ( string format , params object [ ] args )
88
61
{
89
- if ( IsInfoEnabled )
90
- {
91
- _msLogger . LogInformation ( exception , message . ToString ( ) ) ;
92
- }
62
+ _msLogger . LogDebug ( format , args ) ;
93
63
}
94
64
95
- public void InfoFormat ( string format , params object [ ] args )
65
+ public void Fatal ( string message , Exception ex )
96
66
{
97
- if ( IsInfoEnabled )
98
- {
99
- _msLogger . LogInformation ( format , args ) ;
100
- }
67
+ throw new NotImplementedException ( ) ;
101
68
}
102
69
103
- public void Warn ( object message )
70
+ public void Error ( string message , Exception ex )
104
71
{
105
- if ( IsWarnEnabled )
106
- {
107
- _msLogger . LogWarning ( message . ToString ( ) ) ;
108
- }
72
+ throw new NotImplementedException ( ) ;
109
73
}
110
74
111
- public void Warn ( object message , Exception exception )
75
+ public void Warn ( string message , Exception ex )
112
76
{
113
- if ( IsWarnEnabled )
114
- {
115
- _msLogger . LogWarning ( exception , message . ToString ( ) ) ;
116
- }
77
+ throw new NotImplementedException ( ) ;
117
78
}
118
79
119
- public void WarnFormat ( string format , params object [ ] args )
80
+ public void Info ( string message , Exception ex )
120
81
{
121
- if ( IsWarnEnabled )
122
- {
123
- _msLogger . LogWarning ( format , args ) ;
124
- }
82
+ throw new NotImplementedException ( ) ;
83
+ }
84
+
85
+ public void Debug ( string message , Exception ex )
86
+ {
87
+ throw new NotImplementedException ( ) ;
125
88
}
126
89
127
90
public bool IsErrorEnabled => _msLogger . IsEnabled ( LogLevel . Error ) ;
@@ -130,4 +93,4 @@ public void WarnFormat(string format, params object[] args)
130
93
public bool IsInfoEnabled => _msLogger . IsEnabled ( LogLevel . Information ) ;
131
94
public bool IsWarnEnabled => _msLogger . IsEnabled ( LogLevel . Warning ) ;
132
95
}
133
- }
96
+ }
0 commit comments