]>
Dogcows Code - chaz/yoink/blob - src/moof/log.cc
2 /*] Copyright (c) 2009-2010, Charles McGarvey [**************************
3 **] All rights reserved.
7 * Distributable under the terms and conditions of the 2-clause BSD license;
8 * see the file COPYING for a complete text of the license.
10 **************************************************************************/
21 enum log::level
log::global_level_
= log::info
;
24 void log::level(enum level level
)
26 global_level_
= level
;
29 enum log::level
log::level()
35 std::ostream
& log(std::clog
);
37 static std::ofstream null_log_
;
38 std::ostream
& null_log(null_log_
);
40 class log
log_error( log::error
, " error: ");
41 class log
log_warning(log::warning
, "warning: ");
42 class log
log_info( log::info
, " info: ");
45 static int log_script(script
& script
, enum log::level level
)
47 static class log
* logs
[] = {0, &log_error
, &log_warning
, &log_info
};
49 script::slot param
= script
[1];
51 while (!param
.is_none())
53 (*logs
[level
])(param
);
60 void log::import(script
& script
)
62 script
.import_function("LogError",
63 boost::bind(log_script
, _1
, log::error
));
64 script
.import_function("LogWarning",
65 boost::bind(log_script
, _1
, log::warning
));
66 script
.import_function("LogInfo",
67 boost::bind(log_script
, _1
, log::info
));
68 script
.import_function("print",
69 boost::bind(log_script
, _1
, log::info
));
This page took 0.04019 seconds and 4 git commands to generate.