[bcf653] | 1 | /*
|
---|
| 2 | * Project: MoleCuilder
|
---|
| 3 | * Description: creates and alters molecular systems
|
---|
| 4 | * Copyright (C) 2010 University of Bonn. All rights reserved.
|
---|
| 5 | * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
|
---|
| 6 | */
|
---|
| 7 |
|
---|
[06c7a3] | 8 | /*
|
---|
| 9 | * log.cpp
|
---|
| 10 | *
|
---|
| 11 | * Created on: Oct 19, 2009
|
---|
| 12 | * Author: metzler
|
---|
| 13 | */
|
---|
| 14 |
|
---|
[bf3817] | 15 | // include config.h
|
---|
| 16 | #ifdef HAVE_CONFIG_H
|
---|
| 17 | #include <config.h>
|
---|
| 18 | #endif
|
---|
| 19 |
|
---|
[112b09] | 20 | #include "Helpers/MemDebug.hpp"
|
---|
| 21 |
|
---|
[952f38] | 22 | #include "Helpers/logger.hpp"
|
---|
| 23 | #include "Helpers/errorlogger.hpp"
|
---|
[06c7a3] | 24 |
|
---|
| 25 | /**
|
---|
| 26 | * Sets verbosity for the error logger and the standard logger.
|
---|
| 27 | *
|
---|
| 28 | * \param int verbosity level
|
---|
| 29 | */
|
---|
| 30 | void setVerbosity(int verbosityLevel) {
|
---|
[aee1a3] | 31 | logger::getInstance().setVerbosity(verbosityLevel);
|
---|
[06c7a3] | 32 | }
|
---|
| 33 |
|
---|
[92c52f] | 34 | /**
|
---|
| 35 | * Gets verbosity for the error logger and the standard logger.
|
---|
| 36 | *
|
---|
| 37 | * \param int verbosity level
|
---|
| 38 | */
|
---|
| 39 | int getVerbosity() {
|
---|
| 40 | return logger::getInstance().getVerbosity();
|
---|
| 41 | }
|
---|
| 42 |
|
---|
[06c7a3] | 43 | /**
|
---|
| 44 | * Prints a log entry.
|
---|
| 45 | *
|
---|
| 46 | * \param indentation level of the message to log
|
---|
| 47 | */
|
---|
[aee1a3] | 48 | class logger& Log() {
|
---|
[06c7a3] | 49 | return logger::getInstance();
|
---|
| 50 | }
|
---|
| 51 |
|
---|
[58ed4a] | 52 | /** Checks verbosity for logger.
|
---|
| 53 | * Is supposed to be used in construct as this:
|
---|
| 54 | * DoLog(2) && (Log() << Verbose(2) << "message." << endl);
|
---|
| 55 | * If DoLog does not return true, the right-hand side is not evaluated and we save some time.
|
---|
| 56 | * \param verbose verbosity level of this message
|
---|
| 57 | * \return true - print, false - don't
|
---|
| 58 | */
|
---|
| 59 | bool DoLog(int verbose) {
|
---|
[5f612ee] | 60 | return (verbose <= logger::getInstance().verbosity);
|
---|
[58ed4a] | 61 | }
|
---|
| 62 |
|
---|
| 63 | /** Checks verbosity for errorlogger.
|
---|
| 64 | * Is supposed to be used in construct as this:
|
---|
| 65 | * DoLog(2) && (Log() << Verbose(2) << "message." << endl);
|
---|
| 66 | * If DoLog does not return true, the right-hand side is not evaluated and we save some time.
|
---|
| 67 | * \param verbose verbosity level of this message
|
---|
| 68 | * \return true - print, false - don't
|
---|
| 69 | */
|
---|
| 70 | bool DoeLog(int verbose) {
|
---|
[5f612ee] | 71 | return (verbose <= errorLogger::getInstance().verbosity);
|
---|
[58ed4a] | 72 | }
|
---|
| 73 |
|
---|
[06c7a3] | 74 | /**
|
---|
| 75 | * Prints an error log entry.
|
---|
| 76 | *
|
---|
| 77 | * \param indentation level of the message to log
|
---|
| 78 | */
|
---|
[ed58ad] | 79 | class errorLogger & eLog() {
|
---|
[06c7a3] | 80 | return errorLogger::getInstance();
|
---|
| 81 | }
|
---|