Exemplo n.º 1
0
        public static void LogCommon(ServiceLogger.LogLevel logLevel, string message, string customData, ServiceLogger.Component componentName = ServiceLogger.Component.None, string logFileType = "", string logFilePath = "")
        {
            if (ServiceLogger.serviceLog == null)
            {
                ServiceLogger.InitializeMtrtLog();
            }
            if (ServiceLogger.ServiceLogLevel == ServiceLogger.LogLevel.None || logLevel < ServiceLogger.ServiceLogLevel)
            {
                return;
            }
            LogRowFormatter logRowFormatter = new LogRowFormatter(ServiceLogger.MessageTracingServiceLogSchema);

            logRowFormatter[1] = logLevel.ToString();
            if (!string.IsNullOrEmpty(logFileType))
            {
                string[] array = logFileType.Split(new char[]
                {
                    '_'
                });
                logRowFormatter[2] = array[0];
            }
            if (!string.IsNullOrEmpty(logFilePath))
            {
                logRowFormatter[3] = logFilePath;
            }
            logRowFormatter[4] = componentName.ToString();
            logRowFormatter[5] = message;
            if (!string.IsNullOrEmpty(customData))
            {
                logRowFormatter[6] = customData;
            }
            ServiceLogger.serviceLog.Append(logRowFormatter, 0);
        }