GraphLab: Distributed Graph-Parallel API
2.1
|
#include <fstream>
#include <sstream>
#include <cstdlib>
#include <cassert>
#include <cstring>
#include <cstdarg>
#include <pthread.h>
#include <graphlab/util/timer.hpp>
#include <graphlab/logger/assertions.hpp>
Go to the source code of this file.
Classes | |
class | file_logger |
struct | log_dispatch< dostuff > |
Macros | |
#define | LOG_NONE 6 |
#define | LOG_FATAL 5 |
#define | LOG_ERROR 4 |
#define | LOG_WARNING 3 |
#define | LOG_EMPH 2 |
#define | LOG_INFO 1 |
#define | LOG_DEBUG 0 |
#define | OUTPUTLEVEL LOG_EMPH |
#define | COLOROUTPUT |
If set, logs to screen will be printed in color. | |
#define | logger(lvl, fmt,...) (log_dispatch<(lvl >= OUTPUTLEVEL)>::exec(lvl,__FILE__, __func__ ,__LINE__,fmt,##__VA_ARGS__)) |
#define | logbuf(lvl, buf, len) |
#define | logstream(lvl) (log_stream_dispatch<(lvl >= OUTPUTLEVEL)>::exec(lvl,__FILE__, __func__ ,__LINE__) ) |
#define | logger_once(lvl, fmt,...) |
#define | logstream_once(lvl) |
#define | logger_ontick(sec, lvl, fmt,...) |
#define | logstream_ontick(sec, lvl) |
Functions | |
void | __print_back_trace () |
file_logger & | global_logger () |
void | textcolor (FILE *handle, int attr, int fg) |
void | reset_color (FILE *handle) |
Usage: First include logger.hpp. To logger, use the logger() function There are 2 output levels. A "soft" output level which is set by calling global_logger.set_log_level(), as well as a "hard" output level OUTPUTLEVEL which is set in the source code (logger.h).
when you call "logger()" with a loglevel and if the loglevel is greater than both of the output levels, the string will be written. written to a logger file. Otherwise, logger() has no effect.
The difference between the hard level and the soft level is that the soft level can be changed at runtime, while the hard level optimizes away logging calls at compile time.
Definition in file logger.hpp.
#define LOG_DEBUG 0 |
Debugging purposes only
Definition at line 72 of file logger.hpp.
#define LOG_EMPH 2 |
Outputs as LOG_INFO, but in LOG_WARNING colors. Useful for outputting information you want to emphasize.
Definition at line 70 of file logger.hpp.
#define LOG_ERROR 4 |
Used for errors which are recoverable within the scope of the function
Definition at line 68 of file logger.hpp.
#define LOG_FATAL 5 |
Used for fatal and probably irrecoverable conditions
Definition at line 67 of file logger.hpp.
#define LOG_INFO 1 |
Used for providing general useful information
Definition at line 71 of file logger.hpp.
#define LOG_NONE 6 |
OUTPUTLEVEL to LOG_NONE to disable logging
#define LOG_WARNING 3 |
Logs interesting conditions which are probably not fatal
Definition at line 69 of file logger.hpp.
#define logbuf | ( | lvl, | |
buf, | |||
len | |||
) |
Definition at line 114 of file logger.hpp.
#define logger | ( | lvl, | |
fmt, | |||
... | |||
) | (log_dispatch<(lvl >= OUTPUTLEVEL)>::exec(lvl,__FILE__, __func__ ,__LINE__,fmt,##__VA_ARGS__)) |
extracts the filename, line number and function name and calls _log. It will be optimized away if LOG_NONE is set This relies on a few compiler macros. As far as I know, these macros are pretty standard among most other C++ compilers.
Definition at line 110 of file logger.hpp.
#define logger_once | ( | lvl, | |
fmt, | |||
... | |||
) |
Definition at line 121 of file logger.hpp.
#define logger_ontick | ( | sec, | |
lvl, | |||
fmt, | |||
... | |||
) |
Definition at line 138 of file logger.hpp.
#define logstream_once | ( | lvl | ) |
Definition at line 130 of file logger.hpp.
#define logstream_ontick | ( | sec, | |
lvl | |||
) |
Definition at line 148 of file logger.hpp.
#define OUTPUTLEVEL LOG_EMPH |
The minimum level to logger at
Definition at line 82 of file logger.hpp.
void __print_back_trace | ( | ) |
Hack! This is defined in assertions.cpp
Copyright (c) 2009 Carnegie Mellon University. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
For more about this software visit:
http://www.graphlab.ml.cmu.edu
Definition at line 63 of file assertions.cpp.
file_logger& global_logger | ( | ) |
Copyright (c) 2009 Carnegie Mellon University. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
For more about this software visit:
http://www.graphlab.ml.cmu.edu
Definition at line 32 of file logger.cpp.