mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-01-16 10:00:03 -05:00
69 lines
1.6 KiB
C++
69 lines
1.6 KiB
C++
// Copyright (c) 2017-2024, Mudita Sp. z.o.o. All rights reserved.
|
|
// For licensing, see https://github.com/mudita/MuditaOS/blob/master/LICENSE.md
|
|
|
|
#include <log/log.hpp>
|
|
#include <Logger.hpp>
|
|
#include <macros.h>
|
|
|
|
using Log::Logger;
|
|
|
|
int log_Printf(const char *fmt, ...)
|
|
{
|
|
va_list args;
|
|
|
|
// temporarily disable logs in interrupts for heap overwriting reasons
|
|
if (isIRQ()) {
|
|
return 0;
|
|
}
|
|
|
|
va_start(args, fmt);
|
|
const int result = Logger::get().log(Log::Device::DEFAULT, fmt, args);
|
|
va_end(args);
|
|
return result;
|
|
}
|
|
|
|
int log_ignore(LoggerLevel level, const char *file, int line, const char *function, const char *fmt, ...)
|
|
{
|
|
va_list args;
|
|
va_start(args, fmt);
|
|
va_end(args);
|
|
return 0;
|
|
}
|
|
|
|
int log_Log(LoggerLevel level, const char *file, int line, const char *function, const char *fmt, ...)
|
|
{
|
|
va_list args;
|
|
|
|
// temporarily disable logs in interrupts for heap overwriting reasons
|
|
if (isIRQ()) {
|
|
return 0;
|
|
}
|
|
|
|
va_start(args, fmt);
|
|
const int result = Logger::get().log(level, file, line, function, fmt, args);
|
|
va_end(args);
|
|
return result;
|
|
}
|
|
|
|
size_t log_getMaxLineLength()
|
|
{
|
|
return Logger::get().getMaxLineLength();
|
|
}
|
|
|
|
extern "C"
|
|
{
|
|
void bt_log_custom(const char *file, int line, const char *foo, const char *fmt, ...)
|
|
{
|
|
va_list args;
|
|
|
|
// temporarily disable logs in interrupts for heap overwriting reasons
|
|
if (isIRQ()) {
|
|
return;
|
|
}
|
|
|
|
va_start(args, fmt);
|
|
Logger::get().log(LOGTRACE, file, line, foo, fmt, args);
|
|
va_end(args);
|
|
}
|
|
}
|