Exemple #1
0
        /// <summary>
        /// Write a trace message
        /// </summary>
        /// <param name="message">Message to be written</param>
        public override void WriteLine(string message)
        {
            string messageLine;

            lock (this)
            {
                this.stringBuffer.Append(message);
                messageLine = this.stringBuffer.ToString();
                this.stringBuffer.Clear();
            }

            LogFileEventTracing.Trace(messageLine);
        }
 /// <summary>
 /// Initializes the singleton of <see cref="LogFileEventTracing"/> class
 /// </summary>
 /// <param name="logDirectory">Directory where log files should be stored</param>
 /// <param name="logDirectoryQuotaInBytes">Upper bound of total size of all log files in the given directory</param>
 /// <param name="logFileSize">Upper bound of single log file size</param>
 public static void Start(
     string logDirectory,
     long logDirectoryQuotaInBytes = 1024L * 1024L * 1024L * 10L,
     int logFileSize = 1024 * 1024 * 10)
 {
     lock (typeof(LogFileEventTracing))
     {
         if (instance != null)
         {
             return;
         }
         else
         {
             instance = new LogFileEventTracing(logDirectory, logDirectoryQuotaInBytes, logFileSize);
         }
     }
 }