From 1d9def9edae0011eeee8f83dc32fb3797ca2f46b Mon Sep 17 00:00:00 2001 From: Pixel Date: Fri, 7 Oct 2011 15:36:12 -0700 Subject: 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 (!) --- includes/Printer.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'includes/Printer.h') 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 #include 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; }; -- cgit v1.2.3