/// <summary>
        /// Initializes a new instance of <see cref="TraceLogger"/>.
        /// </summary>
        /// <param name="writeCallback">Callback to TraceListener write function. Value can be null.</param>
        /// <param name="flushCallback">Callback to TraceListener flush function. Value can be null.</param>
        public TraceLogger(TraceLoggerWrite writeCallback, TraceLoggerFlush flushCallback)
        {
            Enabled = true;
            ShowTimeStamp = false;
            OnWrite = writeCallback ?? DummyWrite;
            OnFlush = flushCallback ?? DummyFlush;
            IsNewLine = true;

            DateTimeFormatInfo timeFormat = CultureInfo.CurrentCulture.DateTimeFormat;
            TimeStampFormat = timeFormat.ShortDatePattern + " " + timeFormat.LongTimePattern;
            TimeStampFormat = TimeStampFormat.Replace("ss", "ss.fff"); //Include miliseconds
        }
Example #2
0
        /// <summary>
        /// Initializes a new instance of <see cref="TraceLogger"/>.
        /// </summary>
        /// <param name="writeCallback">Callback to TraceListener write function. Value can be null.</param>
        /// <param name="flushCallback">Callback to TraceListener flush function. Value can be null.</param>
        public TraceLogger(TraceLoggerWrite writeCallback, TraceLoggerFlush flushCallback)
        {
            Enabled       = true;
            ShowTimeStamp = false;
            OnWrite       = writeCallback ?? DummyWrite;
            OnFlush       = flushCallback ?? DummyFlush;
            IsNewLine     = true;

            DateTimeFormatInfo timeFormat = CultureInfo.CurrentCulture.DateTimeFormat;

            TimeStampFormat = timeFormat.ShortDatePattern + " " + timeFormat.LongTimePattern;
            TimeStampFormat = TimeStampFormat.Replace("ss", "ss.fff"); //Include miliseconds
        }