예제 #1
0
        /// <summary>
        /// Creates the <see cref="IEventTextFormatter" /> instance.
        /// </summary>
        /// <param name="element">The configuration element.</param>
        /// <returns>
        /// The formatter instance.
        /// </returns>
        public IEventTextFormatter CreateFormatter(XElement element)
        {
            var formatter = this.GetFormatterElement(element);

            EventTextFormatting formatting = (EventTextFormatting)Enum.Parse(typeof(EventTextFormatting), (string)formatter.Attribute("formatting") ?? JsonEventTextFormatter.DefaultEventTextFormatting.ToString());

            return(new JsonEventTextFormatter(formatting, (string)formatter.Attribute("dateTimeFormat")));
        }
예제 #2
0
 public XmlEventTextFormatter(EventTextFormatting formatting = DefaultEventTextFormatting, string dateTimeFormat = null)
 {
     this.Formatting     = formatting;
     this.DateTimeFormat = dateTimeFormat;
     this.settings       = new XmlWriterSettings()
     {
         Indent             = formatting == EventTextFormatting.Indented, // Indent on formatting setting
         OmitXmlDeclaration = true,                                       // Do not add xml declaration
     };
 }
예제 #3
0
 public XmlEventTextFormatter(EventTextFormatting formatting = DefaultEventTextFormatting, string dateTimeFormat = null)
 {
     this.Formatting = formatting;
     this.DateTimeFormat = dateTimeFormat;
     this.settings = new XmlWriterSettings()
     {
         Indent = formatting == EventTextFormatting.Indented,  // Indent on formatting setting
         OmitXmlDeclaration = true,                            // Do not add xml declaration
     };
 }
        /// <summary>
        /// Creates the <see cref="IEventTextFormatter" /> instance.
        /// </summary>
        /// <param name="element">The configuration element.</param>
        /// <returns>
        /// The formatter instance.
        /// </returns>
        public IEventTextFormatter CreateFormatter(XElement element)
        {
            var formatter = this.GetFormatterElement(element);

            EventTextFormatting formatting = (EventTextFormatting)Enum.Parse(typeof(EventTextFormatting), (string)formatter.Attribute("formatting") ?? JsonEventTextFormatter.DefaultEventTextFormatting.ToString());

            var includeSeparator = formatter.Attribute("includeEntrySeparator");

            var jsonFormatter = new JsonEventTextFormatter(formatting, (string)formatter.Attribute("dateTimeFormat"));

            if (includeSeparator != null)
            {
                jsonFormatter.IncludeEntrySeparator = (bool)includeSeparator;
            }

            return(jsonFormatter);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="JsonEventTextFormatter" /> class.
 /// </summary>
 /// <param name="formatting">The <see cref="EventTextFormatting" /> formatting.</param>
 /// <param name="dateTimeFormat">The date time format used for timestamp value.</param>
 public JsonEventTextFormatter(EventTextFormatting formatting = DefaultEventTextFormatting, string dateTimeFormat = null)
 {
     this.formatting = (Newtonsoft.Json.Formatting)formatting;
     this.DateTimeFormat = dateTimeFormat;
 }
예제 #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="JsonEventTextFormatter" /> class.
 /// </summary>
 /// <param name="formatting">The <see cref="EventTextFormatting" /> formatting.</param>
 /// <param name="dateTimeFormat">The date time format used for timestamp value.</param>
 public JsonEventTextFormatter(EventTextFormatting formatting = DefaultEventTextFormatting, string dateTimeFormat = null)
 {
     this.formatting     = (Newtonsoft.Json.Formatting)formatting;
     this.DateTimeFormat = dateTimeFormat;
 }
예제 #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="JsonEventTextFormatter" /> class.
 /// </summary>
 /// <param name="formatting">The <see cref="EventTextFormatting" /> formatting.</param>
 /// <param name="dateTimeFormat">The date time format used for timestamp value.</param>
 public JsonEventTextFormatter(EventTextFormatting formatting = DefaultEventTextFormatting, string dateTimeFormat = null)
 {
     this.formatting            = (Newtonsoft.Json.Formatting)formatting;
     this.DateTimeFormat        = dateTimeFormat;
     this.IncludeEntrySeparator = true;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="JsonEventTextFormatter" /> class.
 /// </summary>
 /// <param name="formatting">The <see cref="EventTextFormatting" /> formatting.</param>
 /// <param name="dateTimeFormat">The date time format used for timestamp value.</param>
 public JsonEventTextFormatter(EventTextFormatting formatting = DefaultEventTextFormatting, string dateTimeFormat = null)
 {
     this.formatting = (Newtonsoft.Json.Formatting)formatting;
     this.DateTimeFormat = dateTimeFormat;
     this.IncludeEntrySeparator = true;
 }