1 #pragma once 2 3 /* from osmocore/logging.h */ 4 5 /*! different log levels */ 6 #define LOGL_DEBUG 1 /*!< debugging information */ 7 #define LOGL_INFO 3 /*!< general information */ 8 #define LOGL_NOTICE 5 /*!< abnormal/unexpected condition */ 9 #define LOGL_ERROR 7 /*!< error condition, requires user action */ 10 #define LOGL_FATAL 8 /*!< fatal, program aborted */ 11 12 /* logging subsystems defined by the library itself */ 13 #define DLGLOBAL -1 /*!< global logging */ 14 15 /*! Log a new message through the Osmocom logging framework 16 * \param[in] ss logging subsystem (e.g. \ref DLGLOBAL) 17 * \param[in] level logging level (e.g. \ref LOGL_NOTICE) 18 * \param[in] fmt format string 19 * \param[in] args variable argument list 20 */ 21 #define LOGP(ss, level, fmt, args...) \ 22 LOGPSRC(ss, level, NULL, 0, fmt, ## args) 23 24 /*! Log through the Osmocom logging framework with explicit source. 25 * If caller_file is passed as NULL, __FILE__ and __LINE__ are used 26 * instead of caller_file and caller_line (so that this macro here defines 27 * both cases in the same place, and to catch cases where callers fail to pass 28 * a non-null filename string). 29 * \param[in] ss logging subsystem (e.g. \ref DLGLOBAL) 30 * \param[in] level logging level (e.g. \ref LOGL_NOTICE) 31 * \param[in] caller_file caller's source file string (e.g. __FILE__) 32 * \param[in] caller_line caller's source line nr (e.g. __LINE__) 33 * \param[in] fmt format string 34 * \param[in] args variable argument list 35 */ 36 #define LOGPSRC(ss, level, caller_file, caller_line, fmt, args...) \ 37 LOGPSRCC(ss, level, caller_file, caller_line, 0, fmt, ##args) 38 39 /* TODO: implement proper logging */ 40 #define LOGPSRCC(ss, level, caller_file, caller_line, cont, fmt, args...) \ 41 do { \ 42 if (caller_file) \ 43 fprintf(stderr, "%d: %s:%d: " fmt, level, (char *) caller_file, caller_line, ##args); \ 44 else \ 45 fprintf(stderr, "%d: %s:%d: " fmt, level, __FILE__, __LINE__, ##args); \ 46 } while(0) 47 48 #define osmo_log_backtrace(ss, level) fprintf(stderr, "%s:%d: backtrace not compiled in.", __FILE__, __LINE__); 49
This page was automatically generated by LXR 0.3.1. • OpenWrt