mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-01-01 02:19:00 -05:00
Added info about product, OS version, commit hash and serial number to log filename to simplify triage and quick sanity check of the logs in cases many log files have to be analyzed.
69 lines
1.5 KiB
C++
69 lines
1.5 KiB
C++
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
|
|
// For licensing, see https://github.com/mudita/MuditaOS/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);
|
|
}
|
|
}
|