diff options
Diffstat (limited to 'include/libcamera/base/log.h')
-rw-r--r-- | include/libcamera/base/log.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/include/libcamera/base/log.h b/include/libcamera/base/log.h index 3fc5ced3..dcaacbe0 100644 --- a/include/libcamera/base/log.h +++ b/include/libcamera/base/log.h @@ -29,16 +29,18 @@ enum LogSeverity { class LogCategory { public: - explicit LogCategory(const char *name); + static LogCategory *create(const char *name); - const char *name() const { return name_; } + const std::string &name() const { return name_; } LogSeverity severity() const { return severity_; } void setSeverity(LogSeverity severity); static const LogCategory &defaultCategory(); private: - const char *name_; + explicit LogCategory(const char *name); + + const std::string name_; LogSeverity severity_; }; @@ -49,7 +51,7 @@ extern const LogCategory &_LOG_CATEGORY(name)(); const LogCategory &_LOG_CATEGORY(name)() \ { \ /* The instance will be deleted by the Logger destructor. */ \ - static LogCategory *category = new LogCategory(#name); \ + static LogCategory *category = LogCategory::create(#name); \ return *category; \ } |