diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/salticidae/util.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/include/salticidae/util.h b/include/salticidae/util.h index 19d87cb..e5d653a 100644 --- a/include/salticidae/util.h +++ b/include/salticidae/util.h @@ -51,12 +51,16 @@ class Logger { protected: FILE *output; bool opened; + const char *prefix; void write(const char *tag, const char *fmt, va_list ap); public: - Logger() : output(stderr), opened(false) {} - Logger(FILE *f) : output(f) {} - Logger(const char *filename): opened(true) { + Logger(const char *prefix): + output(stderr), opened(false), prefix(prefix) {} + Logger(const char *prefix, FILE *f): + output(f), opened(false), prefix(prefix) {} + Logger(const char *prefix, const char *filename): + opened(true), prefix(prefix) { if ((output = fopen(filename, "w")) == nullptr) throw SalticidaeError("logger cannot open file"); } |