예제 #1
0
        public void Log(LogLevel logLevel, string message, string memberName = null, int lineNumber = 0, string memberType = null)
        {
            if (string.IsNullOrWhiteSpace(message))
            {
                return;
            }

            LogMessage logMessage = new LogMessage(new LogMessage.CreateOptions
            {
                CategoryName = CategoryName,
                LogLevel     = logLevel,
                Message      = message,
                MemberType   = memberType,
                MemberName   = memberName,
                LineNumber   = lineNumber
            });

            DataContainer.Add(logMessage);

            Guid?httpRequestId = DataContainer.HttpProperties == null ? (Guid?)null : DataContainer.HttpProperties.Request.Id;

            InternalHelpers.WrapInTryCatch(() =>
            {
                NotifyOnMessage.Notify(logMessage, httpRequestId);
            });
        }
 static KissLogConfiguration()
 {
     InternalHelpers.WrapInTryCatch(() =>
     {
         ModuleInitializer.Init();
     });
 }
예제 #3
0
        public static void NotifyListeners(IEnumerable <Logger> loggers)
        {
            if (loggers == null || !loggers.Any())
            {
                return;
            }

            InternalHelpers.WrapInTryCatch(() =>
            {
                NotifyFlush.Notify(loggers.ToArray());
            });
        }
예제 #4
0
        public static void NotifyListeners(Logger logger)
        {
            if (logger == null)
            {
                return;
            }

            InternalHelpers.WrapInTryCatch(() =>
            {
                NotifyFlush.Notify(new[] { logger });
            });
        }
예제 #5
0
        public Logger(string categoryName = null, string url = null)
        {
            Id            = Guid.NewGuid();
            CategoryName  = string.IsNullOrWhiteSpace(categoryName) ? Constants.DefaultLoggerCategoryName : categoryName;
            DataContainer = new LoggerDataContainer(this);

            HttpProperties httpProperties = string.IsNullOrWhiteSpace(url) ? null : HttpPropertiesFactory.Create(url);

            if (httpProperties != null)
            {
                DataContainer.SetHttpProperties(httpProperties);

                InternalHelpers.WrapInTryCatch(() =>
                {
                    NotifyBeginRequest.Notify(httpProperties.Request);
                });
            }
        }