/// <summary>
 /// Initializing constructor
 /// </summary>
 /// <param name="contained">Tracker source object whose calls are to be logged</param>
 /// <param name="logWriter">TextWriter which will receive log output</param>
 /// <param name="config">Configuration object for the LoggingSourceDecorator</param>
 public LoggingSourceDecorator( ISource              contained,
                                TextWriter           logWriter,
                                LoggingSourceConfig  config     ) : base( contained )
 {
     _logWriter = logWriter;
     _config = new LoggingSourceConfig( config );
 }
Exemple #2
0
        /// <summary>
        /// Creates a new instance of the source tracker.
        /// </summary>
        /// <param name="settings">Source settings object describing the source configuration</param>
        /// <returns>Newly created source instance</returns>
        public ISource Create( SourceSettings settings )
        {
            ISource     source = CreateSource( settings );

            if( NoUpdates )
            {
                source = new ReadOnlySourceDecorator( source );
            }

            if( LogLevel != SyncLogLevel.None )
            {
                LoggingSourceConfig     loggingConfig = new LoggingSourceConfig();

                loggingConfig.IsInputLogged = ( LogLevel >= SyncLogLevel.Verbose );
                loggingConfig.IsOutputLogged = ( LogLevel >= SyncLogLevel.PrintActions );

                source = new LoggingSourceDecorator( source,
                                                     Console.Out,
                                                     loggingConfig );
            }

            return source;
        }
 /// <summary>
 /// Initializes an instance of LoggingSourceConfig from another instance of
 /// the class
 /// </summary>
 /// <param name="other">Existing instance which is providing source values</param>
 public LoggingSourceConfig( LoggingSourceConfig other )
 {
     this.IsInputLogged = other.IsInputLogged;
     this.IsOutputLogged = other.IsOutputLogged;
 }