コード例 #1
0
        private object Formatter(HttpEventCollectorEventInfo eventInfo)
        {
            var settings = new JsonSerializerSettings {
                NullValueHandling = NullValueHandling.Ignore
            };

            settings.Converters.Add(new StringEnumConverter());

            return(JsonConvert.SerializeObject(eventInfo.Event.Data, settings));
        }
コード例 #2
0
        // This is where the magic happens
        public CustomLogObject CustomFormatter(HttpEventCollectorEventInfo eventInfo)
        {
            var level               = eventInfo.Event.GetType().GetProperty("Level").GetValue(eventInfo.Event, null);
            var renderedMessage     = eventInfo.Event.GetType().GetProperty("RenderedMessage").GetValue(eventInfo.Event, null);
            var deserializedMessage = JsonConvert.DeserializeObject <RenderedMessage>(renderedMessage);

            var ret = new CustomLogObject
            {
                Level           = level,
                RenderedMessage = deserializedMessage
            };

            return(ret);
        }
コード例 #3
0
 public dynamic Formatter(HttpEventCollectorEventInfo info)
 {
     return(CustomFormatter(info));
 }