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 |
|
---|
8 | /*
|
---|
9 | * log.cpp
|
---|
10 | *
|
---|
11 | * Created on: Oct 19, 2009
|
---|
12 | * Author: metzler
|
---|
13 | */
|
---|
14 |
|
---|
15 | // include config.h
|
---|
16 | #ifdef HAVE_CONFIG_H
|
---|
17 | #include <config.h>
|
---|
18 | #endif
|
---|
19 |
|
---|
20 | #include "Helpers/MemDebug.hpp"
|
---|
21 |
|
---|
22 | #include "Helpers/logger.hpp"
|
---|
23 | #include "Helpers/errorlogger.hpp"
|
---|
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) {
|
---|
31 | logger::getInstance().setVerbosity(verbosityLevel);
|
---|
32 | }
|
---|
33 |
|
---|
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 |
|
---|
43 | /**
|
---|
44 | * Prints a log entry.
|
---|
45 | *
|
---|
46 | * \param indentation level of the message to log
|
---|
47 | */
|
---|
48 | class logger& Log() {
|
---|
49 | return logger::getInstance();
|
---|
50 | }
|
---|
51 |
|
---|
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) {
|
---|
60 | return (verbose <= logger::getInstance().verbosity);
|
---|
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) {
|
---|
71 | return (verbose <= errorLogger::getInstance().verbosity);
|
---|
72 | }
|
---|
73 |
|
---|
74 | /**
|
---|
75 | * Prints an error log entry.
|
---|
76 | *
|
---|
77 | * \param indentation level of the message to log
|
---|
78 | */
|
---|
79 | class errorLogger & eLog() {
|
---|
80 | return errorLogger::getInstance();
|
---|
81 | }
|
---|