Send() public method

public Send ( string msg ) : void
msg string
return void
コード例 #1
0
ファイル: ReadmeSnippets.cs プロジェクト: sschmid/NLog
        void setupNLog(MyErrorReporter myErrorReporter)
        {
            LoggerFactory.globalLogLevel = LogLevel.On;

            // Add appender to print messages with Console.WriteLine
            LoggerFactory.AddAppender((logger, logLevel, message) => Console.WriteLine(message));

            // Add another appender to write messages to a file
            var fileWriter = new FileWriter("Log.txt");
            LoggerFactory.AddAppender((logger, logLevel, message) => fileWriter.WriteLine(message));

            // Or simply create your own custom appender, e.g.
            // a custom error reporter, which only sends messages
            // if the log level is at least 'error'
            LoggerFactory.AddAppender((logger, logLevel, message) => {
                if (logLevel >= LogLevel.Error) {
                    myErrorReporter.Send(logLevel + " " + message);
                }
            });
        }
コード例 #2
0
ファイル: ReadmeSnippets.cs プロジェクト: qipa/NLog-1
        void setupNLog(MyErrorReporter myErrorReporter)
        {
            LoggerFactory.globalLogLevel = LogLevel.On;

            // Add appender to print messages with Console.WriteLine
            LoggerFactory.AddAppender((logger, logLevel, message) => Console.WriteLine(message));

            // Add another appender to write messages to a file
            var fileWriter = new FileWriter("Log.txt");

            LoggerFactory.AddAppender((logger, logLevel, message) => fileWriter.WriteLine(message));

            // Or simply create your own custom appender, e.g.
            // a custom error reporter, which only sends messages
            // if the log level is at least 'error'
            LoggerFactory.AddAppender((logger, logLevel, message) => {
                if (logLevel >= LogLevel.Error)
                {
                    myErrorReporter.Send(logLevel + " " + message);
                }
            });
        }