public DefaultLoggerConfiguration(LogEventLevel level = LogEventLevel.Verbose, string fileName = null) { Enrich.FromLogContext(); if (fileName != null) { WriteTo.File(fileName, level, DefaultTemplate); } else { WriteTo.RollingFile(".\\Logs\\log_{HalfHour}.txt", level, DefaultTemplate); } MinimumLevel.Is(level); Destructure.ByTransforming <Money>(r => new { r.Amount, r.CurrencyCode }); Destructure.ByTransforming <Exception>(r => new { Type = r.GetType(), r.Message, r.StackTrace }); Destructure.ByTransforming <MessageMetadata>(r => new { r.CasuationId, r.CorrelationId }); Destructure.ByTransforming <PersistEventPack>(r => new { Size = r.Events?.Length }); Destructure.ByTransforming <MessageMetadataEnvelop <ICommand> >(r => new { CommandType = r.Message.GetType(), CommandId = r.Message.Id, r.Metadata }); Destructure.ByTransforming <MessageMetadataEnvelop <DomainEvent> >(r => new { EventType = r.Message.GetType(), EventId = r.Message.Id, r.Metadata }); Destructure.ByTransforming <AggregateCommandExecutionContext>(r => new { CommandId = r.Command?.Id, Metadata = r.CommandMetadata }); Destructure.ByTransforming <ProcessesTransitComplete>(r => new { Event = r.InitialMessage, ProducedCommandsNum = r.ProducedCommands.Length }); Destructure.ByTransforming <CreateNewProcess>(r => new { Event = (r.Message?.Message as IHaveId)?.Id ?? r.Message?.Message, r.EnforcedId, r.Message?.Metadata }); }
public ShopLogConfiguration(LogEventLevel level = LogEventLevel.Verbose) { WriteTo.Console(level, DefaultTemplate); WriteTo.RollingFile(".\\Logs\\shop_node_log_{HalfHour}.txt", level, DefaultTemplate); }