Ejemplo n.º 1
0
 /// <summary>
 /// Trace the specified message.
 /// </summary>
 /// <param name="message">Message.</param>
 /// <remarks>ITraceService implementation</remarks>
 public void Trace(Message message)
 {
     //			Console.WriteLine("{0}: TraceService: Writing: {1}", DateTime.Now, message.ToString());
     byte[] buf = Encoding.ASCII.GetBytes(string.Concat(message.ToString(), "\n"));
     _file.Write(buf, 0, buf.Length);
     _file.Flush();
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TraceService.MessageSurrogated"/> class.
 /// </summary>
 /// <param name="message">Message.</param>
 public MessageSurrogated(Message message)
 {
     Time = message.Time;
     Source = message.Source;
     SourceName = message.Source.Name;
     Level = message.Level;
     Id = message.Id;
     Category = message.Category;
     Description = message.Description;
     Data = message.Data;
     DataValues = new object[Data.Count];
     message.Data.Values.CopyTo(DataValues, 0);
     Stack = message.Stack;
     Domain = message.Domain;
     Process = message.Process;
     ProcessId = message.Process.Id;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Trace the specified message.
 /// </summary>
 /// <param name="message">Message.</param>
 public abstract void Trace(Message message);
Ejemplo n.º 4
0
 /// <summary>
 /// Log the specified message.
 /// </summary>
 /// <param name="message">Message.</param>
 private void Log(Message message)
 {
     _messageQueue.Enqueue(message);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Logs the exception.
 /// </summary>
 /// <param name="ex">Ex.</param>
 /// <param name="data">Data.</param>
 public void LogException(Exception ex, params object[] data)
 {
     Message msg = new Message(this, data) {
         Level = MessageLevel.Error,
         Category = "Execution",
         Description = ex.ToString()		//.GetType().FullName
     };
     Log(msg);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Logs the method call.
 /// </summary>
 /// <param name="level">Level.</param>
 /// <param name="data">Data.</param>
 public void LogMethodCall(MessageLevel level, params object[] data)
 {
     StackFrame sf = new StackFrame(1, true);
     MethodBase method = sf.GetMethod();
     StringBuilder sb = new StringBuilder(256);
     sb.AppendFormat("{0}.{1}", method.DeclaringType.FullName, method.Name);
     if (method.ContainsGenericParameters)
     {
         sb.Append("<");
         foreach (Type TParam in method.GetGenericArguments())
             sb.AppendFormat("{0}, ", TParam.FullName);
         sb.Remove(sb.Length - 2, 2);
         sb.Append(">");
     }
     sb.Append("(");
     foreach (ParameterInfo pi in sf.GetMethod().GetParameters())
         sb.AppendFormat("{0} {1}, ", pi.ParameterType.FullName, pi.Name);
     sb.Remove(sb.Length - 2, 2);
     sb.Append(")");
     Message msg = new Message(this, data)
     {
         Level = level,
         Category = "Execution",
         Description = "Method Call"
     };
     Log(msg);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Log the specified level, category, description and data.
 /// </summary>
 /// <param name="level">Level.</param>
 /// <param name="data">Data.</param>
 public void Log(MessageLevel level, params object[] data)
 {
     Message msg = new Message(this, data)
     {
         Level = level
     };
     Log(msg);
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Log the specified level, category, description and data.
 /// </summary>
 /// <param name="level">Level.</param>
 /// <param name="description">Description.</param>
 /// <param name="data">Data.</param>
 public void Log(MessageLevel level, string description, params object[] data)
 {
     Message msg = new Message(this, data)
     {
         Level = level,
         Description = description
     };
     Log(msg);
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Trace the specified message.
 /// </summary>
 /// <param name="message">Message.</param>
 /// <remarks>Listener implementation</remarks>
 public override void Trace(Message message)
 {
     Proxy.Trace(message);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Trace the specified message.
 /// </summary>
 /// <param name="message">Message.</param>
 /// <remarks>Listener implementation</remarks>
 public override void Trace(Message message)
 {
     Console.WriteLine(message.ToString());
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Trace the specified message.
 /// </summary>
 /// <param name="message">Message.</param>
 /// <remarks>Listener implementation</remarks>
 public override void Trace(Message message)
 {
     Log.Add(message);
 }