meerkat
is hosted by
Hepforge
,
IPPP Durham
Home
Source code
Doxygen
Contact
Meerkat
v1r3
Multidimensional kernel density estimation package
Main Page
Namespaces
Classes
Files
File List
File Members
src
Logger.cpp
Go to the documentation of this file.
1
#include "
Logger.hh
"
2
#include <time.h>
3
#include <stdarg.h>
4
#include <stdio.h>
5
6
static
int
last_timer
;
7
static
int
log_level
= 0;
8
9
void
Logger::setTimer
(
void
) {
10
last_timer
= time(0);
11
}
12
13
int
Logger::timer
(
int
secs) {
14
int
t = time(0);
15
if
( t -
last_timer
> secs ) {
16
last_timer
= t;
17
return
1;
18
}
else
{
19
return
0;
20
}
21
}
22
23
void
Logger::setLogLevel
(
int
level) {
24
log_level
= level;
25
}
26
27
void
Logger::print
(
int
level,
const
char
* fmt, ...) {
28
if
(level >=
log_level
) {
29
va_list ap;
30
va_start(ap, fmt);
31
vprintf(fmt, ap);
32
va_end(ap);
33
}
34
}
log_level
static int log_level
Definition:
Logger.cpp:7
Logger::print
void print(int level, const char *format,...)
Definition:
Logger.cpp:27
Logger::setTimer
void setTimer(void)
Reset time counter.
Definition:
Logger.cpp:9
Logger::timer
int timer(int secs)
Return 1 if more than a certain number of seconds have passed since the last call of this function or...
Definition:
Logger.cpp:13
Logger.hh
Logger::setLogLevel
void setLogLevel(int level)
Definition:
Logger.cpp:23
last_timer
static int last_timer
Definition:
Logger.cpp:6
Generated by
1.8.9.1