diff options
Diffstat (limited to 'slips/src/app/Marina/Infrastructure/Logging/Log4Net/Log4NetLogFactory.cs')
| -rw-r--r-- | slips/src/app/Marina/Infrastructure/Logging/Log4Net/Log4NetLogFactory.cs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/slips/src/app/Marina/Infrastructure/Logging/Log4Net/Log4NetLogFactory.cs b/slips/src/app/Marina/Infrastructure/Logging/Log4Net/Log4NetLogFactory.cs new file mode 100644 index 0000000..996557f --- /dev/null +++ b/slips/src/app/Marina/Infrastructure/Logging/Log4Net/Log4NetLogFactory.cs @@ -0,0 +1,30 @@ +using System;
+using log4net;
+using Marina.Infrastructure.Logging.Interfaces;
+using ILog=Marina.Infrastructure.Logging.Interfaces.ILog;
+
+namespace Marina.Infrastructure.Logging.Log4Net {
+ public class Log4NetLogFactory : ILogFactory {
+ private ILog4NetInitializationCommand initializationCommand;
+ private bool initialized;
+
+ public Log4NetLogFactory( ) : this( new Log4NetInitializationCommand( ) ) {}
+
+ public Log4NetLogFactory( ILog4NetInitializationCommand initializationCommand ) {
+ this.initializationCommand = initializationCommand;
+ }
+
+ public ILog CreateFor( Type typeThatRequiresLoggingServices ) {
+ WireUpConfiguration( );
+ return new Log4NetLog( LogManager.GetLogger( typeThatRequiresLoggingServices ) );
+ }
+
+ private void WireUpConfiguration( ) {
+ if ( initialized ) {
+ return;
+ }
+ initialized = true;
+ initializationCommand.Execute( );
+ }
+ }
+}
\ No newline at end of file |
