static void Main(string[] args) { var config = new NLog.Config.LoggingConfiguration(); using (var fluentdTarget = new NLog.Targets.Fluentd()) { fluentdTarget.Layout = new NLog.Layouts.SimpleLayout("${longdate}|${level}|${callsite}|${logger}|${message}"); config.AddTarget("fluentd", fluentdTarget); config.LoggingRules.Add(new NLog.Config.LoggingRule("demo", LogLevel.Debug, fluentdTarget)); var loggerFactory = new LogFactory(config); var logger = loggerFactory.GetLogger("demo"); logger.Info("Hello World!"); } }
static void Main(string[] args) { var config = new NLog.Config.LoggingConfiguration(); using (var fluentdTarget = new NLog.Targets.Fluentd()) { fluentdTarget.Layout = new NLog.Layouts.SimpleLayout("${longdate}|${level}|${callsite}|${logger}|${message}"); config.AddTarget("fluentd", fluentdTarget); config.LoggingRules.Add(new NLog.Config.LoggingRule("demo", LogLevel.Debug, fluentdTarget)); var loggerFactory = new LogFactory(config); var logger = loggerFactory.GetLogger("demo"); logger.Info("Hello World!"); } }
public void Write(string message) { var config = new NLog.Config.LoggingConfiguration(); using (var fluentdTarget = new NLog.Targets.Fluentd()) { // Setting up our docker contianer (fluentD) host // fluentdTarget.Host = _settings?.FluentLoggerServerIp; fluentdTarget.Layout = new NLog.Layouts.SimpleLayout("${longdate}|${level}|${callsite}|${logger}|${message}"); config.AddTarget("fluentd", fluentdTarget); config.LoggingRules.Add(new NLog.Config.LoggingRule("demo", NLog.LogLevel.Debug, fluentdTarget)); var loggerFactory = new LogFactory(config); var logger = loggerFactory.GetLogger("demo"); logger.Info(message); } }