Skip to content

Logging file library used in projects created by the Code Generator tool.

License

Notifications You must be signed in to change notification settings

Tolitech/CodeGenerator.Logging.File

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Tolitech.CodeGenerator.Logging.File

Logging File library used in projects created by the Code Generator tool.

This project contains the implementation for recording logs in physical text files.

Tolitech Code Generator Tool: http://www.tolitech.com.br

Examples:

// Constructor
public LoggingFileTest()
{
    var config = new ConfigurationBuilder()
        .SetBasePath(Directory.GetCurrentDirectory())
        .AddJsonFile("appsettings.json", false, true)
        .Build();

    var logLevel = (LogLevel)config.GetSection("Logging:File:LogLevel").GetValue(typeof(LogLevel), "Default");

    var loggerFactory = LoggerFactory.Create(logger =>
    {
        logger
            .AddConfiguration(config.GetSection("Logging"))
            .AddFileLogger(x => 
            {
                x.LogLevel = logLevel;
            });
    });

    _logger = loggerFactory.CreateLogger<LoggingFileTest>();
}
_logger.LogTrace("test1");
_logger.LogDebug("test2");
_logger.LogInformation("test3");
_logger.LogWarning("test4");
_logger.LogError("test5");
_logger.LogCritical("test6");

About

Logging file library used in projects created by the Code Generator tool.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages