1

replace char*/string with stringview

This commit is contained in:
2022-07-29 14:35:44 +02:00
parent 873d3927c7
commit c0dfd881e9
2 changed files with 12 additions and 27 deletions

View File

@ -5,6 +5,7 @@
#include "lib/OutStream.h"
#include "lib/SpinLock.h"
#include "user/lib/String.h"
#include "user/lib/StringView.h"
class Logger : public OutStream {
public:
@ -19,7 +20,7 @@ private:
static bool kout_enabled;
static bool serial_enabled;
void log(const char* message, CGA::color col) const;
void log(const bse::string_view message, CGA::color col) const;
friend class NamedLogger; // Allow NamedLogger to lock/unlock
@ -46,21 +47,17 @@ public:
void flush() override;
void trace(const char* message) const;
void trace(const bse::string& message) const;
void debug(const char* message) const;
void debug(const bse::string& message) const;
void error(const char* message) const;
void error(const bse::string& message) const;
void info(const char* message) const;
void info(const bse::string& message) const;
void trace(const bse::string_view message) const;
void debug(const bse::string_view message) const;
void error(const bse::string_view message) const;
void info(const bse::string_view message) const;
// TODO: Make lvl change accessible over menu
static void set_level(LogLevel lvl) {
Logger::level = lvl;
}
static char* level_to_string(LogLevel lvl) {
static bse::string_view level_to_string(LogLevel lvl) {
switch (lvl) {
case Logger::TRACE:
return "TRACE";