summaryrefslogtreecommitdiff
path: root/src/Printer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Printer.cc')
-rw-r--r--src/Printer.cc19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/Printer.cc b/src/Printer.cc
index cb94084..ef0cbf5 100644
--- a/src/Printer.cc
+++ b/src/Printer.cc
@@ -19,6 +19,10 @@ Balau::Printer::Printer() : m_verbosity(M_STATUS | M_WARNING | M_ERROR) {
localPrinter.setGlobal(this);
}
+void Balau::Printer::setLocal() {
+ localPrinter.set(this);
+}
+
Balau::Printer * Balau::Printer::getPrinter() { return localPrinter.get(); }
void Balau::Printer::_log(uint32_t level, const char * fmt, va_list ap) {
@@ -31,11 +35,20 @@ void Balau::Printer::_log(uint32_t level, const char * fmt, va_list ap) {
if (l & level)
break;
- print(prefixes[i]);
- print(fmt, ap);
- print("\n");
+ Printer * printer = getPrinter();
+
+ printer->_print(prefixes[i]);
+ printer->_print(fmt, ap);
+ printer->_print("\n");
}
void Balau::Printer::_print(const char * fmt, va_list ap) {
vfprintf(stderr, fmt, ap);
}
+
+void Balau::Printer::_print(const char * fmt, ...) {
+ va_list ap;
+ va_start(ap, fmt);
+ _print(fmt, ap);
+ va_end(ap);
+}