コード例 #1
0
        public void Log(ILoggerMessage message)
        {
            Task.Run(() =>
            {
                Logs sqlLogMessage = new Logs
                {
                    Error          = message.IsError,
                    Message        = message.GetMessage(),
                    Source         = message.GetSource(),
                    TimeOfCreation = message.GetTimeOfCreation(),
                    Class          = message.GetClassName()
                };

                using (Context con = new Context(config))
                {
                    con.Logs.Add(sqlLogMessage);
                    con.SaveChanges();
                }
            });
        }
コード例 #2
0
        public void Log(ILoggerMessage message)
        {
            String theText = String.Format("{0}; {1}; {2}: {3}\n", message.GetTimeOfCreation().ToLongTimeString(), message.GetSource(), message.GetClassName(), message.GetMessage());

            if (message.IsError)
            {
                Console.Error.Write(theText);
            }
            else
            {
                Console.Out.Write(theText);
            }
        }
コード例 #3
0
        public void Log(ILoggerMessage message)
        {
            String theText = String.Format("{0}; {1}; {2}: {3}\n", message.GetTimeOfCreation().ToLongTimeString(), message.GetSource(), message.GetClassName(), message.GetMessage());

            System.Diagnostics.Debug.Write(theText);
        }