Skip to content

Extension contributor for TacitusLogger that generates additional info related to the thread on which the logger method was called.

License

Notifications You must be signed in to change notification settings

hanlarmammadov/TacitusLogger.Contributors.ThreadInfo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TacitusLogger.Contributors.ThreadInfo

Extension contributor for TacitusLogger that generates additional info related to the thread on which the logger method was called.

Dependencies:

  • .Net Standard >= 2.0
  • TacitusLogger >= 0.2.0

Attention: TacitusLogger.Contributors.ThreadInfo is currently in Alpha phase. This means you should not use it in any production code.

Installation

The NuGet package:

PM> Install-Package TacitusLogger.Contributors.ThreadInfo

Examples

Adding thread info contributor to the logger

With builders:

Logger logger = LoggerBuilder.Logger()
                             .Contributors()
                                 .ThreadInfo()
                             .BuildContributors()
                             .ForAllLogs()
                                 .Console().Add()
                             .BuildLogger();

Directly:

ThreadInfoContributor threadInfo = new ThreadInfoContributor();

Logger logger = new Logger();
logger.AddLogContributor(threadInfo);

Explicitly specifying name and status of thread info contributor

With builders:

Logger logger = LoggerBuilder.Logger()
                             .Contributors()
                                 .ThreadInfo(true, "Thread")
                             .BuildContributors()
                             .ForAllLogs()
                                 .Console().Add()
                             .BuildLogger();

Directly:

ThreadInfoContributor threadInfo = new ThreadInfoContributor("Thread");
threadInfo.SetActive(true);

Logger logger = new Logger();
logger.AddLogContributor(threadInfo);

Explicitly specifying mutable status of thread info contributor

With builders:

Logger logger = LoggerBuilder.Logger()
                             .Contributors()
                                 .ThreadInfo(status)
                             .BuildContributors()
                             .ForAllLogs()
                                 .Console().Add()
                             .BuildLogger();

Directly:

MutableSetting<bool> status = Setting<bool>.From.Variable(true);
ThreadInfoContributor threadInfo = new ThreadInfoContributor("Thread");
threadInfo.SetActive(status);

Logger logger = new Logger();
logger.AddLogContributor(threadInfo);

License

APACHE LICENSE 2.0

See also

TacitusLogger:

Destinations:

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:

About

Extension contributor for TacitusLogger that generates additional info related to the thread on which the logger method was called.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages