Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use code mode to add fields #12

Open
aofong opened this issue Apr 27, 2017 · 1 comment
Open

How to use code mode to add fields #12

aofong opened this issue Apr 27, 2017 · 1 comment

Comments

@aofong
Copy link

aofong commented Apr 27, 2017

var config = new LoggingConfiguration();
var mongoTarget = new MongoTarget();
 config.AddTarget("targetMongo", mongoTarget);
nlog.config
<field name="AppName" layout="${AppName}"/>
@snakefoot
Copy link
Contributor

You can do this::

var config = new LoggingConfiguration();
var mongoTarget = new NLog.Mongo.MongoTarget();
mongoTarget.Fields.Add(new NLog.Mongo.MongoField() { Name = "AppName", Layout = "${AppName}" });
config.AddTarget("targetMongo", mongoTarget);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants