Exemplo n.º 1
0
        protected override void ProcessCountMetricEvent(CountMetricEventInstance countMetricEvent)
        {
            StringBuilder stringBuilder = InitializeStringBuilder(countMetricEvent.EventTime.ToLocalTime());

            stringBuilder.Append(countMetricEvent.Metric.Name);
            streamWriter.WriteLine(stringBuilder.ToString());
            streamWriter.Flush();
        }
        /// <include file='InterfaceDocumentationComments.xml' path='doc/members/member[@name="M:ApplicationLogging.IApplicationLogger.Log(ApplicationLogging.LogLevel,System.String)"]/*'/>
        public void Log(LogLevel level, string text)
        {
            // Typically this and the other Log() method overrides would check that the class was not closed and not disposed, so that an exception with a clear message could be throw in the case that either were true.
            //    However, in the interest of performance such checks are omitted.

            if (level >= minimumLogLevel)
            {
                streamWriter.WriteLine(CreateLogEntry(level, text).ToString());
                streamWriter.Flush();
            }
        }
Exemplo n.º 3
0
 public bool SendLine(string value)
 {
     if (_connection.IsConnected == false)
     {
         _connection.Connect();
     }
     if (_streamWriter == null)
     {
         _streamWriter = _connection.GetStreamWriter();
     }
     try
     {
         _streamWriter.WriteLine(value);
         _streamWriter.Flush();
         _logger.Trace($"Sended: {value}");
         return(true);
     }
     catch
     {
         _streamWriter = null;
         return(false);
     }
 }