diff options
author | Pixel <pixel@nobis-crew.org> | 2011-10-07 15:36:12 -0700 |
---|---|---|
committer | Pixel <pixel@nobis-crew.org> | 2011-10-07 15:36:12 -0700 |
commit | 1d9def9edae0011eeee8f83dc32fb3797ca2f46b (patch) | |
tree | 29077945287dd4b0c13269b9f3e5dc97936551f9 /includes/Printer.h | |
parent | 5a283e5b2b523d53e3504292c386b534dc74386a (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 'includes/Printer.h')
-rw-r--r-- | includes/Printer.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/includes/Printer.h b/includes/Printer.h index b55df22..20b3b6c 100644 --- a/includes/Printer.h +++ b/includes/Printer.h @@ -1,5 +1,6 @@ #pragma once +#include <stdarg.h> #include <BString.h> namespace Balau { @@ -21,14 +22,15 @@ class Printer { virtual void _print(const char * fmt, va_list ap); private: + void _print(const char * fmt, ...); void _log(uint32_t level, const char * fmt, va_list ap); - static Printer * getPrinter(); public: Printer(); void setLocal(); + static Printer * getPrinter(); static void log(uint32_t level, const String & fmt, ...) { va_list ap; va_start(ap, fmt); log(level, fmt.to_charp(), ap); va_end(ap); } static void log(uint32_t level, const char * fmt, ...) { va_list ap; va_start(ap, fmt); log(level, fmt, ap); va_end(ap); } static void log(uint32_t level, const char * fmt, va_list ap) { getPrinter()->_log(level, fmt, ap); } @@ -36,8 +38,8 @@ class Printer { static void print(const char * fmt, ...) { va_list ap; va_start(ap, fmt); print(fmt, ap); va_end(ap); } static void print(const char * fmt, va_list ap) { getPrinter()->_print(fmt, ap); } - void enable(uint32_t levels = M_ALL) { m_verbosity |= levels; } - void disable(uint32_t levels = M_ALL) { m_verbosity &= ~levels; } + static void enable(uint32_t levels = M_ALL) { getPrinter()->m_verbosity |= levels; } + static void disable(uint32_t levels = M_ALL) { getPrinter()->m_verbosity &= ~levels; } uint32_t m_verbosity; }; |