summaryrefslogtreecommitdiff
path: root/src/Printer.cc
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2011-10-07 15:36:12 -0700
committerPixel <pixel@nobis-crew.org>2011-10-07 15:36:12 -0700
commit1d9def9edae0011eeee8f83dc32fb3797ca2f46b (patch)
tree29077945287dd4b0c13269b9f3e5dc97936551f9 /src/Printer.cc
parent5a283e5b2b523d53e3504292c386b534dc74386a (diff)
More work in the Task manager.
Also fixing a few bugs linked with the printer and TLS. Removed flto from compilation flags: this actually creates bad code (!)
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);
+}