Commit 6316f23e authored by Michal Vaner's avatar Michal Vaner

Dummy log function to mark places to log

It will be replaced, but a function is better than comment, because:
* It prints the text to stderr at last for now
* Compiler can find the places for us when we remove the function, we
  would have to grep for the comments.

git-svn-id: svn://bind10.isc.org/svn/bind10/branches/vorner-recursor-dummylog@3357 e5f2f494-b856-4b98-b285-d166d9295462
parent f6b4e919
......@@ -463,6 +463,7 @@ AC_CONFIG_FILES([Makefile
src/lib/datasrc/Makefile
src/lib/datasrc/tests/Makefile
src/lib/xfr/Makefile
src/lib/log/Makefile
])
AC_OUTPUT([src/bin/cfgmgr/b10-cfgmgr.py
src/bin/cfgmgr/tests/b10-cfgmgr_test.py
......
......@@ -568,7 +568,7 @@ WARN_LOGFILE =
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
INPUT = ../src/lib/cc ../src/lib/config ../src/lib/dns ../src/lib/exceptions ../src/lib/datasrc ../src/bin/auth ../src/lib/bench
INPUT = ../src/lib/cc ../src/lib/config ../src/lib/dns ../src/lib/exceptions ../src/lib/datasrc ../src/bin/auth ../src/lib/bench ../src/lib/log
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
......
SUBDIRS = exceptions dns asiolink cc config datasrc python xfr bench
SUBDIRS = exceptions dns asiolink cc config datasrc python xfr bench log
AM_CXXFLAGS = $(B10_CXXFLAGS)
lib_LTLIBRARIES = liblog.la
liblog_la_SOURCES = dummylog.cc
// Copyright (C) 2010 CZ NIC
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
#include "dummylog.h"
#include <iostream>
using namespace std;
namespace isc {
namespace log {
bool denabled = false;
string dprefix;
void dlog(const string& message) {
if (denabled) {
if (!dprefix.empty()) {
cerr << "[" << dprefix << "] ";
}
cerr << message << endl;
}
}
}
}
// Copyright (C) 2010 CZ NIC
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
#ifndef _ISC_DUMMYLOG_H
#define _ISC_DUMMYLOG_H 1
#include <string>
namespace isc {
namespace log {
/// Are we doing logging?
extern bool denabled;
/**
* \short Prefix into logs.
*
* The prefix is printed in front of every log message in square brackets.
* The usual convention is to put the name of program here.
*/
extern std::string dprogram;
/**
* \short Temporary interface to logging.
*
* This is a temporary function to do logging. It has wrong interface currently
* and should be replaced by something else. It's main purpose now is to mark
* places where logging should happen. When it is removed, compiler will do
* our work of finding the places.
*
* The only thing it does is printing the dprogram prefix, message and
* a newline if denabled is true.
*
* There are no tests for this function, since it is only temporary and
* trivial. Tests will be written for the real logging framework when it is
* created.
*
* It has the d in front of the name so it is unlikely anyone will create
* a real logging function with the same name and the place wouldn't be found
* as a compilation error.
*
* @param message The message to log. The real interface will probably have
* more parameters.
*/
void dlog(const std::string& message);
}
}
#endif // _ISC_DUMMYLOG_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment