llama_ros: llama.cpp for ROS 2
Loading...
Searching...
No Matches
logs.hpp File Reference
#include <cstdarg>
#include <cstdio>
#include <cstring>
Include dependency graph for logs.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  llama_utils
 

Macros

#define LLAMA_LOG_ERROR(text, ...)
 
#define LLAMA_LOG_WARN(text, ...)
 
#define LLAMA_LOG_INFO(text, ...)
 
#define LLAMA_LOG_DEBUG(text, ...)
 

Typedefs

typedef void(* llama_utils::LogFunction) (const char *file, const char *function, int line, const char *text,...)
 Type definition for a logging function.
 

Enumerations

enum  llama_utils::LogLevel { llama_utils::ERROR = 0 , llama_utils::WARN , llama_utils::INFO , llama_utils::DEBUG }
 Enum representing different log levels for controlling log verbosity. More...
 

Functions

const char * llama_utils::extract_filename (const char *path)
 Extracts the filename from a given file path.
 
void llama_utils::set_log_level (LogLevel log_level)
 Sets the log level for the logs.
 

Variables

LogFunction llama_utils::log_error = default_log_error
 Pointer to the error logging function.
 
LogFunction llama_utils::log_warn = default_log_warn
 Pointer to the warning logging function.
 
LogFunction llama_utils::log_info = default_log_info
 Pointer to the info logging function.
 
LogFunction llama_utils::log_debug = default_log_debug
 Pointer to the debug logging function.
 
LogLevel llama_utils::log_level = INFO
 The current log level for the application.
 

Macro Definition Documentation

◆ LLAMA_LOG_DEBUG

#define LLAMA_LOG_DEBUG ( text,
... )
Value:
llama_utils::log_debug(llama_utils::extract_filename(__FILE__), \
__FUNCTION__, __LINE__, text, ##__VA_ARGS__)
@ DEBUG
Definition logs.hpp:67
LogLevel log_level
The current log level for the application.
Definition logs.cpp:119
const char * extract_filename(const char *path)
Extracts the filename from a given file path.
Definition logs.hpp:87

◆ LLAMA_LOG_ERROR

#define LLAMA_LOG_ERROR ( text,
... )
Value:
llama_utils::log_error(llama_utils::extract_filename(__FILE__), \
__FUNCTION__, __LINE__, text, ##__VA_ARGS__)
@ ERROR
Log level for error messages. Only critical errors should be logged.
Definition logs.hpp:58

◆ LLAMA_LOG_INFO

#define LLAMA_LOG_INFO ( text,
... )
Value:
llama_utils::log_info(llama_utils::extract_filename(__FILE__), __FUNCTION__, \
__LINE__, text, ##__VA_ARGS__)
@ INFO
Definition logs.hpp:64

◆ LLAMA_LOG_WARN

#define LLAMA_LOG_WARN ( text,
... )
Value:
llama_utils::log_warn(llama_utils::extract_filename(__FILE__), __FUNCTION__, \
__LINE__, text, ##__VA_ARGS__)
@ WARN
Definition logs.hpp:61