Ejemplo n.º 1
0
        public void Emit(LogChannel source, LogLevels level, string tag, string message, object[] args)
        {
            if (paused)
                return;

            LastSource  = source;
            LastLevel   = level;
            LastTag     = tag;
            LastMessage = message;
            LastArgs    = args;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Prints log messages to console with appropriate color or queues messages
        /// to buffer if paused
        /// </summary>
        public void Emit(LogChannel source, LogLevels level, string tag, string msg, object[] args)
        {
            lock (mutex)
            {
                if (paused)
                {
                    queue.Enqueue(new QueuedLog
                    {
                        Source  = source,
                        Level   = level,
                        Tag     = tag,
                        Message = msg,
                        Args    = args,
                    });

                    return;
                }

                string finalTag = tag.PadRight(TagPadding);
                string finalMsg = MessageFormat.LFormat(finalTag, msg);

                switch (level)
                {
                    case LogLevels.Fine:
                        coloredMessage(FineColor, finalMsg, args);
                        return;
                    case LogLevels.Debug:
                        coloredMessage(DebugColor, finalMsg, args);
                        return;
                    case LogLevels.Info:
                        coloredMessage(InfoColor, finalMsg, args);
                        return;
                    case LogLevels.Warning:
                        coloredMessage(WarnColor, finalMsg, args);
                        return;
                    case LogLevels.Severe:
                        coloredMessage(SevereColor, finalMsg, args);
                        return;
                }
            }
        }
Ejemplo n.º 3
0
 void GlobalLog_OnMessage(string message, LogChannel channel)
 {
     WriteOnPage(message, channel.ToString());
 }
Ejemplo n.º 4
0
 public static void Write(string message, LogChannel channel = LogChannel.NOTIFY_MSG)
 {
     Write(message, channel.ToString());
 }
Ejemplo n.º 5
0
        //public Lottery GetLotteryByPeriod(string period)
        //{
            
        //}

        public void WriteLog(string content, LogChannel channel)
        {
            var sql = @" INSERT dbo.Logger
                    ( logContent ,
                      createDate ,
                      logChannel
                    )
            VALUES  ( N'{0}' ,  
                    GETDATE() , 
                    {1})";
            sql = string.Format(sql, content, (int)channel);
            sqlHelper.ExceSql(sql);
        }