Extension destination for TacitusLogger that sends logs to System.Diagnostics.Trace listeners.
Dependencies:
- .Net Standard >=2.0
- TacitusLogger >=0.1.0
Attention:
TacitusLogger.Destinations.Trace
is currently in Alpha phase. This means you should not use it in any production code.
The NuGet package:
PM> Install-Package TacitusLogger.Destinations.Trace
Using builders:
ILogger logger = LoggerBuilder.Logger().ForAllLogs()
.Trace().Add()
.BuildLogger();
Or directly:
TraceDestination traceDestination = new TraceDestination();
Logger logger = new Logger();
logger.AddLogDestinations(traceDestination);
Using builders:
string template = "[$LogDate]-[$LogType]-[$Description]-[From: $Context]-[Src: $Source]-[Id: $LogId]";
ILogger logger = LoggerBuilder.Logger()
.ForAllLogs()
.Trace().WithSimpleTemplateLogText(template)
.Add()
.BuildLogger();
Or directly:
string template = "[$LogDate]-[$LogType]-[$Description]-[From: $Context]-[Src: $Source]-[Id: $LogId]";
TraceDestination traceDestination = new TraceDestination(template);
Logger logger = new Logger();
logger.NewLogGroup(x => true).AddDestinations(traceDestination);
Using builders:
ILogSerializer customLogSerializer = new Mock<ILogSerializer>().Object;
ILogger logger = LoggerBuilder.Logger()
.ForAllLogs()
.Trace().WithCustomLogSerializer(customLogSerializer)
.Add()
.BuildLogger();
Or directly:
ILogSerializer customLogSerializer = new Mock<ILogSerializer>().Object;
TraceDestination traceDestination = new TraceDestination(customLogSerializer);
Logger logger = new Logger();
logger.NewLogGroup(x => true).AddDestinations(traceDestination);
TacitusLogger:
- TacitusLogger - A simple yet powerful .NET logging library.
Destinations:
- TacitusLogger.Destinations.MongoDb - Extension destination for TacitusLogger that sends logs to MongoDb database.
- TacitusLogger.Destinations.RabbitMq - Extension destination for TacitusLogger that sends logs to the RabbitMQ exchanges.
- TacitusLogger.Destinations.Email - Extension destination for TacitusLogger that sends logs as emails using SMTP protocol.
- TacitusLogger.Destinations.EntityFramework - Extension destination for TacitusLogger that sends logs to database using Entity Framework ORM.
Dependency injection:
- TacitusLogger.DI.Ninject - Extension for Ninject dependency injection container that helps to configure and add TacitusLogger as a singleton.
- TacitusLogger.DI.Autofac - Extension for Autofac dependency injection container that helps to configure and add TacitusLogger as a singleton.
- TacitusLogger.DI.MicrosoftDI - Extension for Microsoft dependency injection container that helps to configure and add TacitusLogger as a singleton.
Log contributors:
- TacitusLogger.Contributors.ThreadInfo - Extension contributor for TacitusLogger that generates additional info related to the thread on which the logger method was called.
- TacitusLogger.Contributors.MachineInfo - Extension contributor for TacitusLogger that generates additional info related to the machine on which the log was produced.