Esempio n. 1
0
        public override void LogEntry(string source, string message, SharpCore.Logging.LoggingLevel loggingLevel)
        {
            MailMessage mailMessage = new MailMessage(from, to);
            mailMessage.Subject = source + " (" + loggingLevel.ToString() + ")";
            mailMessage.Body = message;

            SmtpClient smtpClient = new SmtpClient(host);
            smtpClient.Send(mailMessage);
        }
        public override void LogEntry(string source, string message, SharpCore.Logging.LoggingLevel loggingLevel)
        {
            StringWriter writer = new StringWriter();
            writer.WriteLine("Source: " + source);
            writer.WriteLine("Message: " + message);
            writer.WriteLine("Log Level: " + loggingLevel.ToString());

            Message msg = new Message(writer.ToString());

            using (MessageQueue queue = new MessageQueue(path))
            {
                queue.Send(msg);
            }
        }
Esempio n. 3
0
        public override void LogEntry(string source, string message, SharpCore.Logging.LoggingLevel loggingLevel)
        {
            using (StreamWriter writer = new StreamWriter(fileName, true))
            {
                string entry = format;
                entry = entry.Replace("%source", source);
                entry = entry.Replace("%message", message);
                entry = entry.Replace("%loggingLevel", loggingLevel.ToString());
                entry = entry.Replace("%datetime", DateTime.Now.ToString());
                entry = entry.Replace("%newline", Environment.NewLine);
                entry = entry.Replace("%tab", "\t");

                writer.Write(entry);
            }
        }