Exemplo n.º 1
0
        protected override void Write(LogLevelType level, object message, Exception e)
        {
            var sb = new StringBuilder();

            FormatOutput(sb, level, message, e);
            System.Diagnostics.Debug.WriteLine(sb.ToString());
        }
Exemplo n.º 2
0
 public FormatOutputMessage(TraceLogger outer, LogLevelType level, object message, Exception ex)
 {
     this.outer   = outer;
     this.level   = level;
     this.message = message;
     this.ex      = ex;
 }
Exemplo n.º 3
0
 public CapturingLoggerEvent(CapturingLogger source, LogLevelType level, object msg, Exception ex)
 {
     Source        = source;
     Level         = level;
     MessageObject = msg;
     Exception     = ex;
 }
 /// <summary>
 /// Publishes a message and exception with a given log level to the EventHub
 /// </summary>
 /// <param name="message">Message to be communicated to the integrator</param>
 /// <param name="logLevel">The log level which determines the event that is fired of (OnDebug, OnWarn, etc.)</param>
 /// <param name="ex">The exception to be published</param>
 private static void Publish(string message, Exception ex, LogLevelType logLevel)
 {
     if (EventHub.IsListening(logLevel))
     {
         EventHub.RaiseException(new LogEventArgs(message, ex, logLevel));
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="LogEventArgs"/> class.
 /// </summary>
 /// <param name="message">The message.</param>
 /// <param name="ex">The exception.</param>
 /// <param name="logLevel">The severity of the message.</param>
 public LogEventArgs(string message, Exception ex, LogLevelType logLevel)
 {
     Exception = ex;
     Message   = message;
     LogLevel  = logLevel;
     DateTime  = DateTimeOffset.UtcNow;
 }
Exemplo n.º 6
0
        protected override void Write(LogLevelType level, object message, Exception e)
        {
            var msg = new FormatOutputMessage(this, level, message, e);

            if (traceSource != null)
            {
                traceSource.TraceEvent(Map2TraceEventType(level), 0, "{0}", msg);
            }
            else
            {
                switch (level)
                {
                case LogLevelType.Info:
                    System.Diagnostics.Trace.TraceInformation("{0}", msg);
                    break;

                case LogLevelType.Warn:
                    System.Diagnostics.Trace.TraceWarning("{0}", msg);
                    break;

                case LogLevelType.Error:
                case LogLevelType.Fatal:
                    System.Diagnostics.Trace.TraceError("{0}", msg);
                    break;

                default:
                    System.Diagnostics.Trace.WriteLine(msg);
                    break;
                }
            }
        }
Exemplo n.º 7
0
 public static void Write(string message, LogLevelType level, MPAlignerConfiguration conf = null)
 {
     if ((conf == null && level >= confLogLevel) || (conf != null && level >= conf.logLevel && conf.logLevel != LogLevelType.NONE))
     {
         DateTime date    = DateTime.Now;
         string   dateStr = date.ToString("yyyy-MM-dd HH:mm:ss");
         if (level != LogLevelType.ERROR)
         {
             Console.Write("[MPAligner] [");
             Console.Write(level.ToString());
             Console.Write("] ");
             Console.Write(dateStr);
             Console.Write(" ");
             Console.WriteLine(message);
         }
         else
         {
             Console.Error.Write("[MPAligner] [");
             Console.Error.Write(level.ToString());
             Console.Error.Write("] ");
             Console.Error.Write(dateStr);
             Console.Error.Write(" ");
             Console.Error.WriteLine(message);
         }
     }
 }
 public static void Publish(string message, Exception ex, LogLevelType logLevel, Type declaringType)
 {
     if (GlobalEvents.IsListening(logLevel))
     {
         GlobalEvents.RaiseException(null, new LogEventArgs(message, ex, null, logLevel, declaringType));
     }
 }
Exemplo n.º 9
0
        public static void Log(LogLevelType levelType, string message, params object[] arguments)
        {
            var logMessage = levelType + "::" + DateTime.Now.ToString(CultureInfo.InvariantCulture) + "::" + String.Format(message, arguments);
            var previousForegroundColor = Console.ForegroundColor;
            var messageColor = Console.ForegroundColor;
            switch (levelType)
            {
                case LogLevelType.Warn:
                    messageColor = ConsoleColor.DarkMagenta;
                    break;
                case LogLevelType.Error:
                    messageColor = ConsoleColor.DarkRed;
                    break;
                case LogLevelType.Info:
                    messageColor = ConsoleColor.DarkGreen;
                    break;
                case LogLevelType.Debug:
                    messageColor = ConsoleColor.DarkYellow;
                    break;
            }

            if (levelType < Config.LogLevel) return;

            Console.ForegroundColor = messageColor;
            Console.WriteLine(logMessage);
            Console.ForegroundColor = previousForegroundColor;
        }
        private static LogLevel TryParseToLogLevel(LogLevelType logLevelType)
        {
            switch (logLevelType)
            {
            case LogLevelType.Trace:
                return(LogLevel.Trace);

            case LogLevelType.Debug:
                return(LogLevel.Debug);

            case LogLevelType.Info:
                return(LogLevel.Info);

            case LogLevelType.Warning:
                return(LogLevel.Warn);

            case LogLevelType.Error:
                return(LogLevel.Error);

            case LogLevelType.Fatal:
                return(LogLevel.Fatal);

            case LogLevelType.Off:
            case LogLevelType.Unknown:
                return(LogLevel.Off);

            default:
                throw new ArgumentOutOfRangeException("logLevelType");
            }
        }
Exemplo n.º 11
0
        public static void Log(string message, LogLevelType logLevel)
        {
            var logLevelString = string.Empty;


            if ((int)OutputLogLevel > (int)logLevel)
            {
                return;
            }


            switch (logLevel)
            {
            case LogLevelType.Information:
                logLevelString = "[I]";
                break;

            case LogLevelType.Warning:
                logLevelString = "[W]";
                break;

            case LogLevelType.Error:
                logLevelString = "[E]";
                break;

            case LogLevelType.Verbose:
                logLevelString = "[V]";
                break;
            }


            Debug.WriteLine(string.Format("[{0}]{1}: {2}", AtsModule.ModuleName, logLevelString, message));
        }
 public static void Publish(string message, LogLevelType logLevel, Type declaringType)
 {
     if (GlobalEvents.IsListening(logLevel))
     {
         GlobalEvents.RaiseException(null, new LogEventArgs(message, null, null, logLevel, declaringType));
     }
 }
Exemplo n.º 13
0
        protected virtual bool IsLevelEnabled(LogLevelType level)
        {
            int iLevel           = (int)level;
            int iCurrentLogLevel = (int)ArgumentEntity.Level;

            return(iLevel >= iCurrentLogLevel);
        }
Exemplo n.º 14
0
 public LogMessage(object sender, string text, LogLevelType logLevel= LogLevelType.Info)
 {
     LoggerName = sender.GetType().Name;
     TimeStamp = DateTime.Now;
     LogLevel = logLevel;
     Text = text;
 }
Exemplo n.º 15
0
        public static TraceEventType GetTraceEventType(LogLevelType logLevel)
        {
            switch (logLevel)
            {
            case LogLevelType.All:
            case LogLevelType.Trace:
            case LogLevelType.Debug:
                return(TraceEventType.Verbose | TraceEventType.Information | TraceEventType.Warning
                       | TraceEventType.Error | TraceEventType.Critical);

            case LogLevelType.Info:
                return(TraceEventType.Information | TraceEventType.Warning
                       | TraceEventType.Error | TraceEventType.Critical);

            case LogLevelType.Warn:
                return(TraceEventType.Warning | TraceEventType.Error | TraceEventType.Critical);

            case LogLevelType.Error:
                return(TraceEventType.Error | TraceEventType.Critical);

            case LogLevelType.Fatal:
                return(TraceEventType.Critical);

            case LogLevelType.Off:
                return(0);

            default:
                throw new ArgumentOutOfRangeException("logLevel", logLevel, "unknown log level");
            }
        }
Exemplo n.º 16
0
        public static void Log(LogLevelType levelType, string message, params object[] arguments)
        {
            var logMessage = levelType + "::" + DateTime.Now.ToString(CultureInfo.InvariantCulture) + "::" + String.Format(message, arguments);
            var previousForegroundColor = Console.ForegroundColor;
            var messageColor            = Console.ForegroundColor;

            switch (levelType)
            {
            case LogLevelType.Warn:
                messageColor = ConsoleColor.DarkMagenta;
                break;

            case LogLevelType.Error:
                messageColor = ConsoleColor.DarkRed;
                break;

            case LogLevelType.Info:
                messageColor = ConsoleColor.DarkGreen;
                break;

            case LogLevelType.Debug:
                messageColor = ConsoleColor.DarkYellow;
                break;
            }

            if (levelType < Config.LogLevel)
            {
                return;
            }

            Console.ForegroundColor = messageColor;
            Console.WriteLine(logMessage);
            Console.ForegroundColor = previousForegroundColor;
        }
Exemplo n.º 17
0
 public static void WriteLog(LogLevelType LogLevel, String inLogMessage)
 {
     if ((LogLevel > LogLevelType.None) && (LogLevel <= Instance.LogLevel))
     {
         Instance.WriteLineToLog("[" + LogLevel.ToString().ToUpper() + "] " + inLogMessage);
     }
 }
Exemplo n.º 18
0
 public static void HexDump(LogLevelType LogLevel, byte[] inLogMessage)
 {
     if ((LogLevel > LogLevelType.None) && (LogLevel <= Instance.LogLevel))
     {
         Instance.HexDumpToLog(inLogMessage);
     }
 }
Exemplo n.º 19
0
        protected override void Write(LogLevelType level, object message, Exception ex)
        {
            StringBuilder sb = new StringBuilder();

            FormatOutput(sb, level, message, ex);

            ConsoleColor color;

            if (this.useColor && colors.TryGetValue(level, out color))
            {
                var originalColor = Console.ForegroundColor;
                try
                {
                    Console.ForegroundColor = color;
                    Console.Out.WriteLine(sb.ToString());
                    return;
                }
                finally
                {
                    Console.ForegroundColor = originalColor;
                }
            }

            Console.Out.WriteLine(sb.ToString());
        }
Exemplo n.º 20
0
        private SourceLevels Map2SourceLevel(LogLevelType logLevel)
        {
            switch (logLevel)
            {
            case LogLevelType.All:
            case LogLevelType.Trace:
                return(SourceLevels.All);

            case LogLevelType.Debug:
                return(SourceLevels.Verbose);

            case LogLevelType.Info:
                return(SourceLevels.Information);

            case LogLevelType.Warn:
                return(SourceLevels.Warning);

            case LogLevelType.Error:
                return(SourceLevels.Error);

            case LogLevelType.Fatal:
                return(SourceLevels.Critical);

            default:
                return(SourceLevels.Off);
            }
        }
Exemplo n.º 21
0
 public static void Write(string message, LogLevelType level, MPAlignerConfiguration conf=null)
 {
     if ((conf==null && level>=confLogLevel) || (conf!=null && level >= conf.logLevel && conf.logLevel!= LogLevelType.NONE)) {
         DateTime date = DateTime.Now;
         string dateStr = date.ToString("yyyy-MM-dd HH:mm:ss");
         if (level != LogLevelType.ERROR)
         {
             Console.Write("[MPAligner] [");
             Console.Write(level.ToString());
             Console.Write("] ");
             Console.Write(dateStr);
             Console.Write(" ");
             Console.WriteLine(message);
         }
         else
         {
             Console.Error.Write("[MPAligner] [");
             Console.Error.Write(level.ToString());
             Console.Error.Write("] ");
             Console.Error.Write(dateStr);
             Console.Error.Write(" ");
             Console.Error.WriteLine(message);
         }
     }
 }
Exemplo n.º 22
0
        private TraceEventType Map2TraceEventType(LogLevelType logLevel)
        {
            switch (logLevel)
            {
            case LogLevelType.Trace:
                return(TraceEventType.Verbose);

            case LogLevelType.Debug:
                return(TraceEventType.Verbose);

            case LogLevelType.Info:
                return(TraceEventType.Information);

            case LogLevelType.Warn:
                return(TraceEventType.Warning);

            case LogLevelType.Error:
                return(TraceEventType.Error);

            case LogLevelType.Fatal:
                return(TraceEventType.Critical);

            default:
                return(0);
            }
        }
Exemplo n.º 23
0
        private static string RecordMessage(string message, LogLevelType logLevel)
        {
            var sb = new StringBuilder();

            sb.AppendLine("Time: " + DateTime.Now.ToString());
            switch (logLevel)
            {
            case LogLevelType.Warn:
                Console.BackgroundColor = ConsoleColor.Yellow;
                break;

            case LogLevelType.Error:
                Console.BackgroundColor = ConsoleColor.Cyan;
                break;

            case LogLevelType.Fatal:
                Console.BackgroundColor = ConsoleColor.Red;
                break;

            case LogLevelType.Debug:
            case LogLevelType.Info:
            default:

                Console.BackgroundColor = ConsoleColor.White;
                break;
            }

            sb.AppendLine("Message: " + message);

            string finalMessage = sb.ToString();

            Console.WriteLine(finalMessage);

            return(finalMessage);
        }
Exemplo n.º 24
0
        private string WriteLogEntry(List <object> curObjects, string logMessage, LogLevelType curLevel, Exception curException,
                                     string destinationMachineName, string applicationName, string uniqueId, string winUser, string tenantId)
        {
            if (string.IsNullOrEmpty(uniqueId))
            {
                uniqueId = Guid.NewGuid().ToString();
            }

            var nLogLevel    = LogLevel.FromString(curLevel.ToString());
            var curLogObject = new LogObject {
                Message = logMessage, CurrentDataObjects = curObjects
            };

            string message;

            switch (_type)
            {
            case SerializerType.Json:
                message = JsonConvert.SerializeObject(curLogObject);
                break;

            case SerializerType.Xml:
                using (var sw = new StringWriter())
                {
                    _curSerializer.Serialize(sw, curLogObject);
                    message = sw.ToString();
                }
                break;

            default:
                throw new ArgumentOutOfRangeException("_type");
            }

            var logRecord = curException != null ? new LogEventInfo(nLogLevel, null, null, message, null, curException) : new LogEventInfo(nLogLevel, null, message);

            logRecord.Properties["DestinationMachineName"] = destinationMachineName;
            logRecord.Properties["UniqueID"] = uniqueId;
            logRecord.Properties["TenantId"] = tenantId;
            if (!string.IsNullOrEmpty(applicationName))
            {
                logRecord.Properties["AppCode"] = applicationName;
            }
            else
            {
                logRecord.Properties["AppCode"] = Process.GetCurrentProcess().ProcessName;
            }

            if (!string.IsNullOrEmpty(winUser))
            {
                logRecord.Properties["WinUser"] = winUser;
            }
            else
            {
                logRecord.Properties["WinUser"] = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
            }

            _curLogger.Log(logRecord);

            return(uniqueId);
        }
Exemplo n.º 25
0
 protected override bool IsLevelEnabled(LogLevelType level)
 {
     if (!useTraceSource)
     {
         return(base.IsLevelEnabled(level));
     }
     return(traceSource.Switch.ShouldTrace(Map2TraceEventType(level)));
 }
Exemplo n.º 26
0
 public void AddLog(string msg, LogLevelType logLevel, bool immediatelyShow)
 {
     LogWriter.WriteLine(msg);
     if (immediatelyShow)
     {
         LogWriter.Flush();
     }
 }
 public static void Publish(string message, Exception ex, BaseApi api, LogLevelType logLevel)
 {
     if (GlobalEvents.IsListening(logLevel))
     {
         Type declaringType = GetDeclaringType();
         GlobalEvents.RaiseException(null, new LogEventArgs(message, ex, api, logLevel, declaringType));
     }
 }
Exemplo n.º 28
0
        protected override void Write(LogLevelType logLevel, object message, Exception exception)
        {
            var traceEventType = LoggerHelper.GetTraceEventType(logLevel);
            var log            = new TraceLevelLogEntry(category, traceEventType);

            PopulateLogEntry(log, message, exception);
            logWriter.Write(log);
        }
Exemplo n.º 29
0
 public LogEventArgs(string message, Exception ex, BaseApi api, LogLevelType logLevel, Type declaringType)
 {
     this.Exception     = ex;
     this.Message       = message;
     this.Api           = api;
     this.LogLevel      = logLevel;
     this.DateTime      = DateTime.Now;
     this.DeclaringType = declaringType;
 }
 public LogEventArgs(string message, Exception ex, BaseApi api, LogLevelType logLevel, Type declaringType)
 {
     this.Exception = ex;
     this.Message = message;
     this.Api = api;
     this.LogLevel = logLevel;
     this.DateTime = DateTime.Now;
     this.DeclaringType = declaringType;
 }
Exemplo n.º 31
0
        public virtual void Configure()
        {
            var config  = LoggerSection.GetConfig();
            var section = config.Loggers.Cast <LoggerSectionElement>().FirstOrDefault(x => x.Type == typeof(T).Name);

            LogLevel = section != null?section.Level.ToEnum <LogLevelType>() : LogLevelType.Debug;

            Active     = section != null ? section.Active : true;
            parameters = section != null ? section.Parameters : new LoggerSectionParameterCollection();
        }
Exemplo n.º 32
0
 /// <summary>
 /// 输出一条日志信息(该信息将包含一个自动生成的时间元素。如果日志格式设置为“LogFormatType.XML”,则先转为 XML 格式,为日志信息增加“Message”标签对。)
 /// </summary>
 /// <param name="level">日志级别。</param>
 /// <param name="log">日志信息。</param>
 public void Write(LogLevelType level, string log)
 {
     if (this.OutputType != LogOutputType.None && this.OutputLevel != LogOutputLevel.None)
     {
         LogEntity l = new LogEntity()
         {
             Level = level, Message = log
         };
         this.Write(l);
     }
 }
        private static void InternalLog(string message, LogLevelType messageLevel, ProgramType programType)
        {
            if (LogLevelEnough(messageLevel))
            {
                WriteToConsole(message);
            }

            if (LogFileLevelEnough(messageLevel))
            {
                WriteToFile(message, programType);
            }
        }
Exemplo n.º 34
0
        public Log GetLog(string message, LogCategory logCategory, LogLevelType logLevelType = LogLevelType.INFO)
        {
            var id = GetNextLogId();

            return(new Log
            {
                Id = id,
                EventId = id,
                Timestamp = (long)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalMilliseconds,
                LogLevel = logLevelType,
                LogCategory = logCategory,
                Message = message
            });
        }
Exemplo n.º 35
0
        /// <summary>
        ///     Convert the syslog message severity
        ///     level to correspond to the values of
        ///     a different log level enumeration type.
        /// </summary>
        public int LevelAs(LogLevelType type)
        {
            switch (type)
            {
            case LogLevelType.SysLogLevel:
                return((int)Level);

            case LogLevelType.MicrosoftExtensionsLogging:
                return(MicrosoftExtensionsLoggingLevelLookup[(int)Level]);

            case LogLevelType.SystemDiagnostics:
                return(SystemDiagnosticsLevelLookup[(int)Level]);

            default:
                throw new ArgumentException($"Unexpected log level type: {type}");
            }
        }
        /// <summary>
        ///     The is listening.
        /// </summary>
        /// <param name="logLevel">
        ///     The log level.
        /// </param>
        /// <returns>
        ///     The System.Boolean.
        /// </returns>
        internal static bool IsListening(LogLevelType logLevel)
        {
            if (Mute)
            {
                return false;
            }

            bool listening = false;

            switch (logLevel)
            {
                case LogLevelType.Verbose:
                    if (OnVerbose != null)
                    {
                        listening = true;
                    }

                    break;
                case LogLevelType.Debug:
                    if (OnDebug != null)
                    {
                        listening = true;
                    }

                    break;
                case LogLevelType.Info:
                    if (OnInfo != null)
                    {
                        listening = true;
                    }

                    break;
                case LogLevelType.Warn:
                    if (OnWarn != null)
                    {
                        listening = true;
                    }

                    break;
                case LogLevelType.Error:
                    if (OnError != null)
                    {
                        listening = true;
                    }

                    break;
                case LogLevelType.Fatal:
                    if (OnFatal != null)
                    {
                        listening = true;
                    }

                    break;
                default:
                    if (OnDebug != null)
                    {
                        listening = true;
                    }

                    break;
            }

            return listening;
        }
Exemplo n.º 37
0
 public static void Log(this MessageBus msgBus, object sender, string text, LogLevelType logLevel = LogLevelType.Info)
 {
     msgBus.SendMessage(new LogMessage(sender, text, logLevel));
 }
Exemplo n.º 38
0
 protected void Log(string text, LogLevelType logLevel = LogLevelType.Info)
 {
     MessageBus.SendMessage(new LogMessage(this, text, logLevel));
 }
Exemplo n.º 39
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MPAligner.MPAlignerConfiguration"/> class.
 /// </summary>
 public MPAlignerConfiguration()
 {
     mosesPath = "/home/marcis/LU/moses/mosesdecoder/bin/moses";
     dictConfEntryDict = new Dictionary<string, MPAlignerConfigurationDictEntry>();
     translConfEntryDict = new Dictionary<string, MPAlignerConfigurationTranslEntry>();
     langPairEntryDict = new Dictionary<string, MPAlignerConfigurationLangPairEntry>();
     excDictEntryDict = new Dictionary<string, MPAlignerConfigurationExceptionEntry>();
     stopWordListEntryDict = new Dictionary<string, MPAlignerConfigurationStopWordListEntry>();
     allowTrimmedAlignments = false;
     outputFormat="ref_tabsep";
     keepTrackOfFiles = true;
     logLevel = LogLevelType.ERROR;
     forceEnDictInterlingua = false;
     forceEnTranslitInterlingua = false;
     alignmentThreads = 12;
     useMultiThreadedExecution = false;
     printTopTrgForSrc = false;
     concLen = 3;
 }
Exemplo n.º 40
0
        /// <summary>
        /// Loads the configuration from a specified <c>inputFile</c>.
        /// </summary>
        /// <param name='inputFile'>
        /// Input file.
        /// </param>
        public void Load(string inputFile)
        {
            string inputStr = File.ReadAllText(inputFile,Encoding.UTF8);
            MPAlignerConfiguration conf = MPFrameworkFunctions.DeserializeString<MPAlignerConfiguration>(inputStr);

            dictConfEntryDict = conf.dictConfEntryDict;
            mosesPath = conf.mosesPath;
            translConfEntryDict = conf.translConfEntryDict;
            keepTrackOfFiles = conf.keepTrackOfFiles;
            logLevel = conf.logLevel;
            forceEnDictInterlingua = conf.forceEnDictInterlingua;
            forceEnTranslitInterlingua = conf.forceEnTranslitInterlingua;
            outputFormat = conf.outputFormat;
            excDictEntryDict = conf.excDictEntryDict;
            allowTrimmedAlignments = conf.allowTrimmedAlignments;
            stopWordListEntryDict = conf.stopWordListEntryDict;
            langPairEntryDict = conf.langPairEntryDict;
            alignmentThreads = conf.alignmentThreads;
            useMultiThreadedExecution = conf.useMultiThreadedExecution;
            printTopTrgForSrc = conf.printTopTrgForSrc;
            concLen = conf.concLen;
        }
Exemplo n.º 41
0
        private static string FormatText(string text, LogLevelType type)
        {
            StackFrame frame = new StackFrame(2);
            MethodBase method = frame.GetMethod();

            string ClassName = method.DeclaringType.ToString();
            int index = ClassName.LastIndexOf('.');
            if (index > 0)
                ClassName = ClassName.Substring(index + 1);

            return OutputFormat.Replace("%dt", DateTimeString)
                .Replace("%txt",text)
                .Replace("%ll", Enum.GetName(typeof(LogLevelType), type))
                .Replace("%cn", ClassName)
                .Replace("%mn", method.Name)
                .Replace("%tid", Thread.CurrentThread.ManagedThreadId.ToString());
        }
        private static string RecordMessage(string message, LogLevelType logLevel)
        {
            var sb = new StringBuilder();

            sb.AppendLine("Time: " + DateTime.Now.ToString());
            switch (logLevel)
            {
                case LogLevelType.Warn:
                    Console.BackgroundColor = ConsoleColor.Yellow;
                    break;
                case LogLevelType.Error:
                    Console.BackgroundColor = ConsoleColor.Cyan;
                    break;
                case LogLevelType.Fatal:
                    Console.BackgroundColor = ConsoleColor.Red;
                    break;
                case LogLevelType.Debug:
                case LogLevelType.Info:
                default:

                    Console.BackgroundColor = ConsoleColor.White;
                    break;
            }

            sb.AppendLine("Message: " + message);

            string finalMessage = sb.ToString();
            Console.WriteLine(finalMessage);

            return finalMessage;
        }
Exemplo n.º 43
0
 protected void Log(string text, LogLevelType logLevel = LogLevelType.Info)
 {
     MessageBus.Log(this, text, logLevel);
 }
 public static void Publish(string message, Exception ex, BaseApi api, LogLevelType logLevel)
 {
     if (GlobalEvents.IsListening(logLevel))
     {
         Type declaringType = GetDeclaringType();
         GlobalEvents.RaiseException(null, new LogEventArgs(message, ex, api, logLevel, declaringType));
     }
 }
 /// <summary>
 /// Returns true if an event is wired up the specified log level
 /// </summary>
 /// <param name="logLevel"></param>
 /// <returns></returns>
 public static bool IsListening(LogLevelType logLevel)
 {
     return GlobalEvents.IsListening(logLevel);
 }