コード例 #1
0
 // Token: 0x06002541 RID: 9537 RVA: 0x00086686 File Offset: 0x00084886
 public static void AppendToLog(ILogEvent logEvent)
 {
     if (OwaServerLogger.instance != null)
     {
         OwaServerLogger.instance.LogEvent(logEvent);
     }
 }
コード例 #2
0
 private void HandleLogEvent(object obj, ILogEvent aLog)
 {
     if (aLog.Priority >= logLevel)
     {
         Console.Out.WriteLine("NxBRE LOG " + aLog.Priority + " MSG  : " + aLog.Message);
     }
 }
コード例 #3
0
 public void Write(ILogEvent @event)
 {
     if (@event is LogEvent e)
     {
         Write(e);
     }
 }
コード例 #4
0
 // Token: 0x0600252B RID: 9515 RVA: 0x000864E0 File Offset: 0x000846E0
 public static void AppendToLog(ILogEvent logEvent)
 {
     if (OwaClientTraceLogger.instance != null)
     {
         OwaClientTraceLogger.instance.LogEvent(logEvent);
     }
 }
コード例 #5
0
ファイル: FraudControl.cs プロジェクト: vkiktev/NxBRE
 private void HandleLogEvent(object obj, ILogEvent aLog)
 {
     if (aLog.Priority >= LOG_LEVEL)
     {
         Console.WriteLine("[" + aLog.Priority + "] " + aLog.Message);
     }
 }
コード例 #6
0
        public void Prepare(ILogEvent logEvent)
        {
            var context = HttpContext.Current;
            if (context == null || IsRequestResponseHidden(context))
                return;

            var request = context.Request;
            if (request == null)
                return;

            Func<NameValueCollection> formGetter;
            Func<NameValueCollection> queryStringGetter;

            ValidationUtility.GetUnvalidatedCollections(HttpContext.Current, out formGetter, out queryStringGetter);

            var form = formGetter();

            logEvent.Set(KEY_REQUEST_ID, request.GetRequestId());
            logEvent.Set(KEY_REQUEST_IP, request.GetClientAddress());
            logEvent.Set(KEY_REQUEST_METHOD, request.HttpMethod);
            logEvent.Set(KEY_REQUEST_URL, request.Url);
            logEvent.Set(KEY_REQUEST_REFERRER, request.UrlReferrer);
            logEvent.Set(KEY_REQUEST_AGENT, request.UserAgent);

            logEvent.Set(KEY_REQUEST_COOKIES, string.Join("; ", request.Cookies.AllKeys.Select(k => string.Format("{0} = '{1}'", k, request.Cookies[k].Value))));
            logEvent.Set(KEY_REQUEST_POST, string.Join("; ", form.AllKeys.Select(k => string.Format("{0} = '{1}'", k, CensorePasswords && k.ToUpperInvariant().Contains("PASSWORD") ? "*******" : form[k]))));
        }
コード例 #7
0
 protected void HandleLogEvent(object obj, ILogEvent aLog)
 {
     if (aLog.Priority >= logThreshold)
     {
         Console.WriteLine("NxBRE LOG " + aLog.Priority + " MSG  : " + aLog.Message);
     }
 }
コード例 #8
0
        public TimelineElement(ILogEvent logEvent, Point?fixedPoint = null, bool showMapIcon = true)
        {
            if (logEvent == null)
            {
                throw new ArgumentNullException(nameof(logEvent));
            }

            if (fixedPoint.HasValue)
            {
                fixedEventPos = fixedPoint.Value;
            }

            Time  = logEvent.Time;
            Event = logEvent;

            TimelineIcon = logEvent.LogIcon;
            try
            {
                MapIcon = logEvent.MapIcon;
            }
            catch (Exception e)
            {
            }
            if (MapIcon == null)
            {
                ShowMapIcon = false;
            }
            else
            {
                ShowMapIcon    = showMapIcon;
                MapIcon.Width  = 40;
                MapIcon.Height = 40;
            }
        }
コード例 #9
0
ファイル: RequestInterceptor.cs プロジェクト: szlfwolf/Clutch
        public void Prepare(ILogEvent logEvent)
        {
            var context = HttpContext.Current;

            if (context == null || IsRequestResponseHidden(context))
            {
                return;
            }

            var request = context.Request;

            if (request == null)
            {
                return;
            }

            Func <NameValueCollection> formGetter;
            Func <NameValueCollection> queryStringGetter;

            ValidationUtility.GetUnvalidatedCollections(HttpContext.Current, out formGetter, out queryStringGetter);

            var form = formGetter();

            logEvent.Set(KEY_REQUEST_ID, request.GetRequestId());
            logEvent.Set(KEY_REQUEST_IP, request.GetClientAddress());
            logEvent.Set(KEY_REQUEST_METHOD, request.HttpMethod);
            logEvent.Set(KEY_REQUEST_URL, request.Url);
            logEvent.Set(KEY_REQUEST_REFERRER, request.UrlReferrer);
            logEvent.Set(KEY_REQUEST_AGENT, request.UserAgent);

            logEvent.Set(KEY_REQUEST_COOKIES, string.Join("; ", request.Cookies.AllKeys.Select(k => string.Format("{0} = '{1}'", k, request.Cookies[k].Value))));
            logEvent.Set(KEY_REQUEST_POST, string.Join("; ", form.AllKeys.Select(k => string.Format("{0} = '{1}'", k, CensorePasswords && k.ToUpperInvariant().Contains("PASSWORD") ? "*******" : form[k]))));
        }
コード例 #10
0
 private void SecureAppend(ILogEvent logEvent)
 {
     if (BuildFile())
     {
         CleanWriter();
     }
     // TODO: Remove this file access to improve performance
     // TODO: Count bytes written in memory instead.
     // TODO: Maybe use a wrapper class above writer and file
     _file.Refresh();
     if (_file.Exists && _file.Length > MaxLength)
     {
         CleanWriter();
         RollFiles();
     }
     if (_writer == null)
     {
         try
         {
             BuildWriter();
         }
         catch (Exception e) when(e is IOException || e is UnauthorizedAccessException)
         {
             _locked = true;
             BuildFile();
             BuildWriter();
         }
     }
     _writer.WriteLine(_logFormatter.Format(_provider, logEvent));
 }
コード例 #11
0
ファイル: LogToFile.cs プロジェクト: flippynips/EFZ
        /// <summary>
        /// Callback on logging.
        /// </summary>
        protected void OnLog(ILogEvent log)
        {
            // was the lock taken?
            if (_lock.TryTake)
            {
                // yes, write pending log messages
                while (_logs.TryDequeue(out log))
                {
                    _writer.Write(log);
                    _writer.WriteLine();
                }
                // write the current log message
                _writer.Write(log.Type);
                _writer.Write(Chars.Space);
                _writer.Write(log.Message);
                _writer.WriteLine();

                _lock.Release();
            }
            else
            {
                // enqueue the message
                _logs.Enqueue(log);
                ManagerUpdate.Control.AddSingle(Update);
            }
        }
コード例 #12
0
 /// <summary>
 /// default write method
 /// </summary>
 /// <param name="event"></param>
 public void Write(ILogEvent @event)
 {
     if (@event is StatisticEvent <int> e)
     {
         Write(e);
     }
 }
コード例 #13
0
 public void WriteLogEvent(ILogEvent logEvent)
 {
     if (LogFilter(logEvent))
     {
         WriteToMedium(logEvent);
     }
 }
コード例 #14
0
 /// <summary>
 /// Write the ILogEvent to the Logs
 /// </summary>
 /// <param name="event"></param>
 public void Write(ILogEvent @event)
 {
     if (@event is ILogMessage e)
     {
         Write(e);
     }
 }
コード例 #15
0
 public void Save(string path, ILogEvent logEvent)
 {
     if (IsEnabled)
     {
         this._saver.Save(path, logEvent);
     }
 }
コード例 #16
0
 public void Save(ILogEvent logEvent)
 {
     if (IsEnabled)
     {
         this._saver.Save(logEvent);
     }
 }
コード例 #17
0
 public void WriteLogEvent(ILogEvent logEvent)
 {
     if (logEvent.Level >= _minLogLevel)
     {
         _textWriter.WriteLine(logEvent.ToString());
         _textWriter.Flush();
     }
 }
コード例 #18
0
 public void Render(ILogEvent logEvent, XElement message)
 {
     message.Add(new XElement("identity",
                              new XAttribute("name", logEvent.TryGet(KEY_IDENTITY_NAME, null)),
                              new XAttribute("authenticated", logEvent.TryGet(KEY_IDENTITY_AUTHENTICATED, null)),
                              new XAttribute("type", logEvent.TryGet(KEY_IDENTITY_TYPE, null))
                              ));
 }
コード例 #19
0
ファイル: LogFormatter.cs プロジェクト: leoxialtd/Leoxia.Core
        /// <summary>
        ///     Formats the <see cref="ILogEvent" /> with the specified provider.
        /// </summary>
        /// <param name="provider">The provider.</param>
        /// <param name="logEvent">The log event.</param>
        /// <returns></returns>
        public string Format(ILogFormatProvider provider, ILogEvent logEvent)
        {
            var format        = provider.GetFormat();
            var formattedDate = FormatDate(logEvent.Date, provider.GetDateFormat());

            return(string.Format(format, formattedDate, logEvent.Topic, logEvent.Level, logEvent.Message,
                                 logEvent.ThreadId, logEvent.ProcessId, logEvent.Id, logEvent.PreciseTimestamp));
        }
コード例 #20
0
        /// <summary>
        ///     Appends the <see cref="ILogEvent" /> asynchronously.
        /// </summary>
        /// <param name="logEvent">The log event.</param>
        /// <returns></returns>
        public Task AppendAsync(ILogEvent logEvent)
        {
            _events.Enqueue(logEvent);
            var task = _taskFactory.StartNew(OnAppend);

            _tasks.Enqueue(task);
            return(task);
        }
コード例 #21
0
 private void WritePerformanceData()
 {
     if (this.PerformanceTracker != null)
     {
         ILogEvent logEvent = this.PerformanceTracker.GetLogEvent();
         base.WriteObject(ContactLinkingBaseCmdLet.CreateResultObject(this.Identity, logEvent));
     }
 }
コード例 #22
0
        public void Prepare(ILogEvent logEvent)
        {
            var identity = Thread.CurrentPrincipal.Identity;

            logEvent.Set(KEY_IDENTITY_NAME, identity.Name);
            logEvent.Set(KEY_IDENTITY_AUTHENTICATED, identity.IsAuthenticated);
            logEvent.Set(KEY_IDENTITY_TYPE, identity.AuthenticationType);
        }
コード例 #23
0
 public bool Log(ILogEvent logEvent)
 {
     if (IsSendMessageRule(logEvent))
     {
         _messageService.Send(MapToMessageEvent(logEvent));
     }
     return(_logService.Log(logEvent));
 }
コード例 #24
0
        public void PoolLogEvent(ILogEvent logEvent, int incrementPoolingSeconds = 60)
        {
            var incrementPoolingTimeSpan = new TimeSpan(0, 0, 0, incrementPoolingSeconds);

            _lastLogEventDateTime  = DateTime.Now;
            _finishPoolingDateTime = _lastLogEventDateTime.Add(incrementPoolingTimeSpan);
            _logEvents.Enqueue(logEvent);
            Count++;
        }
コード例 #25
0
ファイル: FileAppender.cs プロジェクト: leoxialtd/Leoxia.Core
 /// <summary>
 ///     Appends the specified log event.
 /// </summary>
 /// <param name="logEvent">The log event.</param>
 public void Append(ILogEvent logEvent)
 {
     if (_writer == null)
     {
         _writer           = _factory.CreateStreamWriter(_file);
         _writer.AutoFlush = true;
     }
     _writer.WriteLine(_logFormatter.Format(_provider, logEvent));
 }
コード例 #26
0
        /// <summary>
        /// Logs a new event.
        /// </summary>
        /// <param name="inData">The <c>LogEvent</c> object to send to the database.</param>
        /// <param name="debug">Optional parameter for printing HTTP response codes to the console (false by default).</param>
        public void Log(ILogEvent inData, bool debug = false)
        {
            inData.Data["session_n"]   = flushIndex.ToString();
            inData.Data["client_time"] = DateTime.Now.ToString();
            flushIndex++;
            accruedLog.Add(inData);

            Flush(debug);
        }
コード例 #27
0
        private bool ContextFilter(ILogEvent logEvent)
        {
            var context = (IEventContext)eventContextTreeView.SelectedItem;

            if (context != null)
            {
                return(logEvent.Context.FullName.StartsWith(context.FullName));
            }
            return(true);
        }
コード例 #28
0
ファイル: XmlLayout.cs プロジェクト: JAugustoGuimaraes/Clutch
        private void PrepareEvent(ILogEvent logEvent)
        {
            if (logEvent.IsSet(EVENT_PREPARED))
                return;

            foreach (var interceptor in LogEventInterceptorProviders.Providers.GetInterceptors())
                interceptor.Prepare(logEvent);

            logEvent.Set(EVENT_PREPARED, true);
        }
コード例 #29
0
 private MessageEvent MapToMessageEvent(ILogEvent logEvent)
 {
     return(new MessageEvent()
     {
         EventType = logEvent.EventType,
         PersonName = logEvent.PersonName,
         DateTime = logEvent.DateTime,
         To = new string[] { "Husband", "Wife", "Child" }
     });
 }
コード例 #30
0
        private bool LevelFilter(ILogEvent logEvent)
        {
            var level = EventsLog.Levels.First(thisLevel => thisLevel.Name.ToLower() == logEvent.Level.ToLower());

            if (!level.IsSelected)
            {
                return(false);
            }
            return(true);
        }
コード例 #31
0
        // TODO: reconsider the pattern of using a static constructor
        static DefaultLogger()
        {
            var ts = new TraceSource("SmartSync",
                                     SourceLevels.Critical |
                                     SourceLevels.Error |
                                     SourceLevels.Warning |
                                     SourceLevels.Verbose);

            LogEvent = EventLoggerFactory.CreateEventLogger <ILogEvent>(ts);
        }
コード例 #32
0
        public PooledLogEventQueue(ILogEvent firstLogEvent, int initialPoolingSeconds = 30)
        {
            var initialPoolingTimeSpan = new TimeSpan(0, 0, 0, initialPoolingSeconds);

            _firstLogEventDateTime = DateTime.Now;
            _lastLogEventDateTime  = _firstLogEventDateTime;
            _finishPoolingDateTime = _firstLogEventDateTime.Add(initialPoolingTimeSpan);
            _logEvents.Enqueue(firstLogEvent);
            Count = 1;
        }
コード例 #33
0
ファイル: TestBinder.cs プロジェクト: Ghasan/NxBRE
 protected void ShowAllLogs(object obj, ILogEvent aLog)
 {
     Console.WriteLine("NxBRE Log " + aLog.Priority + " : " + aLog.Message);
 }
コード例 #34
0
 public void Write(ILogEvent logEvent)
 {
     Console.WriteLine(logEvent.Message);
 }
コード例 #35
0
 public void Prepare(ILogEvent logEvent)
 {
     logEvent.Set(KEY_MESSAGE_ID, Guid.NewGuid());
 }
コード例 #36
0
 public void Render(ILogEvent logEvent, XElement message)
 {
     message.Add(new XAttribute("id", logEvent.TryGet(KEY_MESSAGE_ID, "")));
 }
コード例 #37
0
 public void Write(ILogEvent logEvent)
 {
     Trace.WriteLine(logEvent);
 }
コード例 #38
0
 public void Prepare(ILogEvent logEvent)
 {
     logEvent.Set(KEY_RUN_ID, RunId);
 }
コード例 #39
0
        public void Render(ILogEvent logEvent, XElement message)
        {
            var requestElement = message.Element("request");
            if (requestElement == null)
            {
                requestElement = new XElement("request");
            }
            requestElement.SetAttributeValue("id", logEvent.TryGet(KEY_REQUEST_ID, null));
            requestElement.SetAttributeValue("ip", logEvent.TryGet(KEY_REQUEST_IP, null));
            requestElement.SetAttributeValue("method", logEvent.TryGet(KEY_REQUEST_METHOD, null));
            requestElement.SetAttributeValue("url", logEvent.TryGet(KEY_REQUEST_URL, null));
            requestElement.SetAttributeValue("referrer", logEvent.TryGet(KEY_REQUEST_REFERRER, null));

            if (logEvent.IsSet(KEY_REQUEST_AGENT))
            {
                var agentElement = requestElement.Element("agent");
                if (agentElement == null)
                {
                    agentElement = new XElement("agent");
                    requestElement.Add(agentElement);
                }
                agentElement.SetValue(logEvent.Get(KEY_REQUEST_AGENT));
            }

            if (logEvent.IsSet(KEY_REQUEST_COOKIES))
            {
                var cookiesElement = requestElement.Element("cookies");
                if (cookiesElement == null)
                {
                    cookiesElement = new XElement("cookies");
                    requestElement.Add(cookiesElement);
                }
                cookiesElement.SetValue(logEvent.Get(KEY_REQUEST_COOKIES));
            }

            if (logEvent.IsSet(KEY_REQUEST_POST))
            {
                var postElement = requestElement.Element("post");
                if (postElement == null)
                {
                    postElement = new XElement("post");
                    requestElement.Add(postElement);
                }
                postElement.SetValue(logEvent.Get(KEY_REQUEST_POST));
            }

            if (requestElement.Parent == null && (!requestElement.IsEmpty || requestElement.Attributes().Any()))
            {
                message.Add(requestElement);
            }
        }
コード例 #40
0
ファイル: BREFactoryConsole.cs プロジェクト: Ghasan/NxBRE
 private void HandleLogEvent(object obj, ILogEvent aLog)
 {
     if (aLog.Priority >= logLevel)
         Console.Out.WriteLine("NxBRE LOG " + aLog.Priority + " MSG  : " + aLog.Message);
 }
コード例 #41
0
ファイル: RatingEngine.cs プロジェクト: Ghasan/NxBRE
 private void HandleLogEvent(object obj, ILogEvent aLog)
 {
     if (aLog.Priority >= LogEventImpl.DEBUG)
         Console.WriteLine("[" + aLog.Priority + "] " + aLog.Message);
 }
コード例 #42
0
 public void Write(ILogEvent logEvent)
 {
     if (Enabled)
         foreach (var provider in Providers)
             provider.Write(logEvent);
 }
コード例 #43
0
ファイル: LogSet.cs プロジェクト: RobSmyth/nlogcruncher
 public bool Includes(ILogEvent logEvent)
 {
     return events.ContainsKey(logEvent);
 }
コード例 #44
0
        public bool EventIsHidden(ILogEvent logEvent)
        {
            var context = logEvent.Context;

            if (context.ShowEvents != ShowEvents.Unknown)
            {
                return context.ShowEvents == ShowEvents.Yes ? false : true;
            }

            var isHidden = (!ReferenceEquals(logEvent, ReferenceLogEvent)) && HiddenMessages.Contains(logEvent.Message);

            if (!isHidden)
            {
                foreach (var eventContext in _cachedContexts)
                {
                    if (eventContext.ShowEvents == ShowEvents.HideThisAndChildren)
                    {
                        if (eventContext.IsEqualOrParentOf(context))
                        {
                            isHidden = true;
                            context.ShowEvents = ShowEvents.HideThisAndChildren;
                            break;
                        }
                    }
                }
            }

            if (context.ShowEvents != ShowEvents.Yes)
            {
                if (!_cachedContexts.Contains(context))
                {
                    _cachedContexts.Add(context);
                }

                if (!_hiddenContextsCache.Contains(context))
                {
                    _hiddenContextsCache.Add(context);
                }
            }

            return isHidden;
        }
コード例 #45
0
ファイル: LogSets.cs プロジェクト: RobSmyth/nlogcruncher
 public ILogSet[] GetSetsFor(ILogEvent logEvent)
 {
     return sets.FindAll(thisSet => thisSet.Includes(logEvent)).ToArray();
 }
コード例 #46
0
ファイル: TestBREImpl.cs プロジェクト: Ghasan/NxBRE
        public void handleLogEvent(object obj, ILogEvent aLog)
        {
            logCount++;

            if ((aLog.Priority == 3) && (aLog.Message == ASSERTED_HELLO_VALUE))
                foundDynamicLog = true;

            if (aLog.Priority >= 5)
                Console.Out.WriteLine("NxBRE LOG " + aLog.Priority + " MSG  : " + aLog.Message);
        }
コード例 #47
0
 public void Render(ILogEvent logEvent, XElement Run)
 {
     Run.Add(new XAttribute("runId", logEvent.TryGet(KEY_RUN_ID, "")));
 }
コード例 #48
0
        public void Write(ILogEvent logEvent)
        {

        }
コード例 #49
0
ファイル: AbstractTestEngine.cs プロジェクト: Ghasan/NxBRE
 protected void HandleLogEvent(object obj, ILogEvent aLog)
 {
     if (aLog.Priority >= logThreshold)
         Console.WriteLine("NxBRE LOG " + aLog.Priority + " MSG  : " + aLog.Message);
 }