Beispiel #1
0
 /// <summary>
 /// User implementable log method (e.g. what actions they need to take to perform
 /// a "log" operation, like logging to a file for example).
 /// </summary>
 /// <param name="message"></param>
 protected abstract void log(LoggerMessage message);
Beispiel #2
0
 protected override void log(LoggerMessage message)
 {
     if (stream == null) return;
     string time = System.DateTime.FromFileTime(message.time).ToString();
     string test = "[" + time + " [" + message.level + ":" + message.level_desc + " (" + message.tag + ")] " + message.message + " ]\r\n";
     stream.Write("[" + time + " [" + message.level + ":" + message.level_desc + " (" + message.tag + ")] " + message.message + " ]\r\n");
 }
Beispiel #3
0
        /// <summary>
        /// Responsible for queuing the log message
        /// </summary>
        /// <param name="tag"></param>
        /// <param name="level"></param>
        /// <param name="level_desc"></param>
        /// <param name="message"></param>
        public void log(string tag, int level, string level_desc, string message)
        {
            if (!alive) return;

            LoggerMessage lm = new LoggerMessage();
            lm.message = message;
            lm.tag = tag;
            lm.level = level;
            lm.level_desc = level_desc;
            lm.time = System.DateTime.Now.ToFileTime();

            q.Enqueue(lm);

            Monitor.Enter(q);
            Monitor.PulseAll(q);
            Monitor.Exit(q);
        }