Skip to content

This library aims to provide easy logging in .netcore web application.

Notifications You must be signed in to change notification settings

mkojoa/eazy-logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eazy-logger

made-with-csharp License: MIT

Logging is an important part of modern application development, regardless of the platform targeted. This is why easy-logger is here to make log integration much easier. This library aims to provide easy logging in .netcore ^3.1 web application.

Channel Drivers

Fuel my efforts with a cup of Coffee.

Buy Me A Coffee

Get Started

Installation (Not Yet)

- Install-Package eazy-logger

eazy-logger

eazy-logger is based on channels. Each channel represents a specific way of writing application logs information. Use the enabled property on the LoggerOption to enable or disable and log to any channel defined here - [appsettings]

Note :
- By default File logging is set to true with path Logs/logs.txt.

Add UseEazyLogging() to the web host builder in BuildWebHost().

  public static IHostBuilder CreateHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
            .UseEazyLogging()
                .ConfigureWebHostDefaults(webBuilder =>
                {
                    webBuilder.UseStartup<Startup>();
                });

Once you have configured the UseEazyLogging() in the Program.cs file, you're ready to define the LoggerOptions in the app.settings.json.

appsettings
  "LoggerOptions": {
    "name": "eazy-api",
    "ignoredPaths": [ "logs", "/ping", "/metrics" ],
    "level": "information",
    "file": {
      "enabled": true,
      "path": "Logs/logs.txt",
      "interval": "day"
    },
    "seq": {
      "enabled": false,
      "url": "http://localhost:5341",
      "token": "secret"
    },
    "database": {
      "enabled": true,
      "name": "Db-Name",
      "table": "Logs",
      "instance": "SQL-Instant-Name",
      "userName": "sudo",
      "password": "root",
      "encrypt": "False",
      "trustedConnection": "False",
      "trustServerCertificate": "True",
      "integratedSecurity": "SSPI"
    }
  }

Contributing

Please do open issues if you spot any bugs, or would like to suggest new features/changes.

About

This library aims to provide easy logging in .netcore web application.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published