1 // Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
2 //
3 // This Source Code Form is subject to the terms of the Mozilla Public
4 // License, v. 2.0. If a copy of the MPL was not distributed with this
5 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 
7 #include <config.h>
8 
9 #include <log/macros.h>
10 #include <log/logger_support.h>
11 #include <log/log_messages.h>
12 
13 using namespace isc::log;
14 
15 /// \brief Test InitLogger
16 ///
17 /// A program used in testing the logger that initializes logging using
18 /// initLogger(), then outputs several messages at different severities and
19 /// debug levels.  An external script sets the environment variables and checks
20 /// that they have the desired effect.
21 
22 int
main(int,char **)23 main(int, char**) {
24     initLogger();
25     Logger logger("log");
26 
27     LOG_DEBUG(logger, 0, LOG_BAD_DESTINATION).arg("debug-0");
28     LOG_DEBUG(logger, 50, LOG_BAD_DESTINATION).arg("debug-50");
29     LOG_DEBUG(logger, 99, LOG_BAD_DESTINATION).arg("debug-99");
30     LOG_INFO(logger, LOG_BAD_SEVERITY).arg("info");
31     LOG_WARN(logger, LOG_BAD_STREAM).arg("warn");
32     LOG_ERROR(logger, LOG_DUPLICATE_MESSAGE_ID).arg("error");
33     LOG_FATAL(logger, LOG_NO_MESSAGE_ID).arg("fatal");
34 
35     return (0);
36 }
37