示例#1
0
        public override Task WriteAsync(EventLogRecord eventLogRecord)
        {
            if ((eventLogRecord.DataObject is object) &&
                (eventLogRecord.DataByte == null) &&
                string.IsNullOrEmpty(eventLogRecord.DataText))
            {
                eventLogRecord.DataByte = Brimborium.Latrans.JSON.JsonSerializer.Serialize(eventLogRecord.DataObject);
            }

            var stream = this._Stream;

            if (stream is object)
            {
                ReadableLogUtil.WriteUtf8(eventLogRecord, stream);
            }

            return(Task.CompletedTask);
        }
示例#2
0
        public override void Write(EventLogRecord eventLogRecord)
        {
            if ((eventLogRecord.DataObject is object) &&
                (eventLogRecord.DataByte == null) &&
                string.IsNullOrEmpty(eventLogRecord.DataText))
            {
                var t = this._JsonSerializerFacade.Serialize(eventLogRecord.DataObject);
                eventLogRecord.TypeName = t.TypeName;
                eventLogRecord.DataByte = t.DataByte;
            }

            var stream = this._Stream;

            if (stream is object)
            {
                ReadableLogUtil.WriteUtf8(eventLogRecord, stream);
                //stream.Flush();
            }
        }