19 #include <uuid/console.h>
25 #if UUID_CONSOLE_THREAD_SAFE
41 static const char __pstr__logger_name[] __attribute__((__aligned__(PSTR_ALIGN))) PROGMEM =
"shell";
45 static const uuid::log::Logger logger_instance{
reinterpret_cast<const __FlashStringHelper *
>(__pstr__logger_name), uuid::log::Facility::LPR};
47 return logger_instance;
51 : id_(id), content_(std::move(content)) {
56 #if UUID_CONSOLE_THREAD_SAFE
57 std::lock_guard<std::mutex> lock{
mutex_};
76 #if UUID_CONSOLE_THREAD_SAFE
77 std::lock_guard<std::mutex> lock{
mutex_};
84 #if UUID_CONSOLE_THREAD_SAFE
85 std::lock_guard<std::mutex> lock{
mutex_};
95 #if UUID_CONSOLE_THREAD_SAFE
96 std::unique_lock<std::mutex> lock{
mutex_};
106 #if UUID_CONSOLE_THREAD_SAFE
118 println(message.content_->text);
127 #if UUID_CONSOLE_THREAD_SAFE
131 #if UUID_CONSOLE_THREAD_SAFE
139 #if UUID_CONSOLE_THREAD_SAFE
size_t maximum_log_messages() const
Get the maximum number of queued log messages.
Logger instance used to make log messages.
void display_prompt()
Output a prompt on the shell.
std::list< QueuedLogMessage > log_messages_
size_t print(const std::string &data)
Output a string.
unsigned long log_message_id_
static constexpr size_t MAX_LOG_MESSAGES
static const uuid::log::Logger & logger()
Get the built-in uuid::log::Logger instance for shells.
size_t println(const std::string &data)
Output a string followed by CRLF end of line characters.
uuid::log::Level log_level() const
Get the current log level.
Level
Severity level of log messages.
static void register_handler(Handler *handler, Level level)
Register a log handler.
static Level get_log_level(const Handler *handler)
Get the current log level of a handler.
virtual void operator<<(std::shared_ptr< uuid::log::Message > message)
Add a new log message.
size_t printf(const char *format,...)
Output a message.
QueuedLogMessage(unsigned long id, std::shared_ptr< uuid::log::Message > &&content)
Create a queued log message.
std::string format_timestamp_ms(uint64_t timestamp_ms, unsigned int days_width)
Format a system uptime timestamp as a string.
virtual void erase_current_line()
Output ANSI escape sequence to erase the current line.
void output_logs()
Output queued log messages for this shell.
char format_level_char(Level level)
Format a log level as a single character.
size_t maximum_log_messages_