示例#1
0
 public void Log(LoggerThreshold threshold, string line)
 {
     this.doLogging(threshold, () =>
     {
         this.write(line);
     });
 }
示例#2
0
        // working method to execute logging in multi threading app
        protected void doLogging(LoggerThreshold threshold, Action loggingAction)
        {
            if (!thresholdReached(threshold))
            {
                return;
            }

            mutex.WaitOne();
            loggingAction();
            mutex.ReleaseMutex();
        }
示例#3
0
        public void Cache(LoggerThreshold threshold, string line)
        {
            if (this.logCache == null)
            {
                this.logCache = new List <string>();
            }

            if (this.thresholdReached(threshold))
            {
                mutex.WaitOne();
                this.logCache.Add(line);
                mutex.ReleaseMutex();
            }
        }
示例#4
0
 // test if info needs to get logged
 protected bool thresholdReached(LoggerThreshold threshold)
 {
     return((int)threshold <= (int)this.LogThreshold);
 }