//------------------------------------------------------------------------------ // // Method: ConsoleMetricLogger (constructor) // //------------------------------------------------------------------------------ /// <summary> /// Initialises a new instance of the ApplicationMetrics.ConsoleMetricLogger class. /// </summary> /// <param name="bufferProcessingStrategy">Object which implements a processing strategy for the buffers (queues).</param> /// <param name="intervalMetricChecking">Specifies whether an exception should be thrown if the correct order of interval metric logging is not followed (e.g. End() method called before Begin()).</param> public ConsoleMetricLogger(IBufferProcessingStrategy bufferProcessingStrategy, bool intervalMetricChecking) { loggerImplementation = new ConsoleMetricLoggerImplementation(bufferProcessingStrategy, intervalMetricChecking); }
//------------------------------------------------------------------------------ // // Method: ConsoleMetricLogger (constructor) // //------------------------------------------------------------------------------ /// <summary> /// Initialises a new instance of the ApplicationMetrics.ConsoleMetricLogger class. Note this is an additional constructor to facilitate unit tests, and should not be used to instantiate the class under normal conditions. /// </summary> /// <param name="bufferProcessingStrategy">Object which implements a processing strategy for the buffers (queues).</param> /// <param name="intervalMetricChecking">Specifies whether an exception should be thrown if the correct order of interval metric logging is not followed (e.g. End() method called before Begin()).</param> /// <param name="console">A test (mock) console object.</param> /// <param name="dateTime">A test (mock) DateTime object.</param> /// <param name="exceptionHandler">A test (mock) exception handler object.</param> public ConsoleMetricLogger(IBufferProcessingStrategy bufferProcessingStrategy, bool intervalMetricChecking, IConsole console, IDateTime dateTime, IExceptionHandler exceptionHandler) { loggerImplementation = new ConsoleMetricLoggerImplementation(bufferProcessingStrategy, intervalMetricChecking, console, dateTime, exceptionHandler); }
//------------------------------------------------------------------------------ // // Method: ConsoleMetricLogger (constructor) // //------------------------------------------------------------------------------ /// <summary> /// Initialises a new instance of the ApplicationMetrics.ConsoleMetricLogger class. /// </summary> /// <remarks>This constructor defaults to using the LoopingWorkerThreadBufferProcessor as the buffer processing strategy, and is maintained for backwards compatibility.</remarks> /// <param name="dequeueOperationLoopInterval">The time to wait (in milliseconds) between iterations of the worker thread which dequeues metric events and writes them to the console.</param> /// <param name="intervalMetricChecking">Specifies whether an exception should be thrown if the correct order of interval metric logging is not followed (e.g. End() method called before Begin()).</param> public ConsoleMetricLogger(int dequeueOperationLoopInterval, bool intervalMetricChecking) { loggerImplementation = new ConsoleMetricLoggerImplementation(new LoopingWorkerThreadBufferProcessor(dequeueOperationLoopInterval, false), intervalMetricChecking); }