Example #1
0
        public void WriteEvent(ref DryadEventDescriptor dryadEventDescriptor, string ModuleName, string Source, DateTime TimeStamp, Exception Exception, string Message)
        {
            try
            {
                lock (m_lock)
                {
                    if (m_provider != null)
                    {
                        m_provider.WriteLine(
                            String.Format("\"{0}\",\"{1}\",\"{2}\",\"{3}\",\"{4}\",\"{5}\",\"{6}\",\"{7}\"",
                            dryadEventDescriptor.Message,
                            TimeStamp.ToString("yyyy/MM/dd HH:mm:ss.fff", System.Globalization.CultureInfo.InvariantCulture),
                            System.Diagnostics.Process.GetCurrentProcess().Id,
                            System.Threading.Thread.CurrentThread.ManagedThreadId,
                            ModuleName,
                            Source,
                            String.IsNullOrEmpty(Message) ? String.Empty : Message,
                            (Exception == null) ? String.Empty : Exception.ToString()
                            ));

                        if (m_provider.BaseStream.Position > m_maxFileBytes)
                        {
                            m_rolloverCount++;
                            ReopenLogFile();
                        }
                    }
                }
            }
            catch
            {
            }
        }
Example #2
0
 public void WriteEvent(ref DryadEventDescriptor dryadEventDescriptor, string ModuleName, string Source, DateTime TimeStamp, Exception Exception, string MessageFormat, params object[] MessageParameters)
 {
     try
     {
         WriteEvent(ref dryadEventDescriptor, ModuleName, Source, TimeStamp, Exception, String.Format(MessageFormat, MessageParameters));
     }
     catch
     {
     }
 }
Example #3
0
        public void WriteEvent(ref DryadEventDescriptor dryadEventDescriptor, string ModuleName, string Source, DateTime TimeStamp, string OperationContext, string MessageFormat, params object[] MessageParameters)
        {
            try
            {
                StringBuilder newMessage = new StringBuilder();
                if (!String.IsNullOrEmpty(OperationContext))
                {
                    newMessage.Append(OperationContext);
                    newMessage.Append(": ");
                }

                newMessage.Append(String.Format(MessageFormat, MessageParameters));

                WriteEvent(ref dryadEventDescriptor, ModuleName, Source, TimeStamp, newMessage.ToString());
            }
            catch
            {
            }
        }