Created
December 29, 2016 16:13
-
-
Save jamessdixon/c0f2f65b4bace53597f9440245930781 to your computer and use it in GitHub Desktop.
Programmic NLog Example Using FSharp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#r "../packages/NLog.4.4.1/lib/net45/NLog.dll" | |
open NLog | |
let config = new Config.LoggingConfiguration() | |
let target = new Targets.ColoredConsoleTarget("ConsoleTarget") | |
config.AddTarget(target) | |
let rule = new Config.LoggingRule() | |
rule.EnableLoggingForLevel(LogLevel.Trace) | |
rule.Targets.Add(target) | |
config.LoggingRules.Add(rule) | |
LogManager.Configuration <- config | |
let logger = LogManager.GetCurrentClassLogger() | |
logger.Trace("This is a test message") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment