mirror of
https://github.com/transmission/transmission.git
synced 2026-05-08 09:39:08 +01:00
make all the log functions/structs/enums use a single 'tr_log' namespace, such as tr_logGetQueue, tr_logAddInfo, tr_logIsLevelActive
This commit is contained in:
@@ -101,96 +101,6 @@ const char * tr_strip_positional_args (const char * fmt);
|
||||
*****
|
||||
****/
|
||||
|
||||
#define TR_MAX_MSG_LOG 10000
|
||||
|
||||
extern tr_msg_level __tr_message_level;
|
||||
|
||||
static inline tr_msg_level tr_getMessageLevel (void)
|
||||
{
|
||||
return __tr_message_level;
|
||||
}
|
||||
|
||||
static inline bool tr_msgLoggingIsActive (tr_msg_level level)
|
||||
{
|
||||
return tr_getMessageLevel () >= level;
|
||||
}
|
||||
|
||||
void tr_msg (const char * file, int line,
|
||||
tr_msg_level level,
|
||||
const char * torrent,
|
||||
const char * fmt, ...) TR_GNUC_PRINTF (5, 6);
|
||||
|
||||
#define tr_nerr(n, ...) \
|
||||
do { \
|
||||
if (tr_msgLoggingIsActive (TR_MSG_ERR)) \
|
||||
tr_msg (__FILE__, __LINE__, TR_MSG_ERR, n, __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#define tr_ninf(n, ...) \
|
||||
do { \
|
||||
if (tr_msgLoggingIsActive (TR_MSG_INF)) \
|
||||
tr_msg (__FILE__, __LINE__, TR_MSG_INF, n, __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#define tr_ndbg(n, ...) \
|
||||
do { \
|
||||
if (tr_msgLoggingIsActive (TR_MSG_DBG)) \
|
||||
tr_msg (__FILE__, __LINE__, TR_MSG_DBG, n, __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#define tr_torerr(tor, ...) \
|
||||
do { \
|
||||
if (tr_msgLoggingIsActive (TR_MSG_ERR)) \
|
||||
tr_msg (__FILE__, __LINE__, TR_MSG_ERR, tr_torrentName (tor), __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#define tr_torinf(tor, ...) \
|
||||
do { \
|
||||
if (tr_msgLoggingIsActive (TR_MSG_INF)) \
|
||||
tr_msg (__FILE__, __LINE__, TR_MSG_INF, tr_torrentName (tor), __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#define tr_tordbg(tor, ...) \
|
||||
do { \
|
||||
if (tr_msgLoggingIsActive (TR_MSG_DBG)) \
|
||||
tr_msg (__FILE__, __LINE__, TR_MSG_DBG, tr_torrentName (tor), __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#define tr_err(...) \
|
||||
do { \
|
||||
if (tr_msgLoggingIsActive (TR_MSG_ERR)) \
|
||||
tr_msg (__FILE__, __LINE__, TR_MSG_ERR, NULL, __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#define tr_inf(...) \
|
||||
do { \
|
||||
if (tr_msgLoggingIsActive (TR_MSG_INF)) \
|
||||
tr_msg (__FILE__, __LINE__, TR_MSG_INF, NULL, __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#define tr_dbg(...) \
|
||||
do { \
|
||||
if (tr_msgLoggingIsActive (TR_MSG_DBG)) \
|
||||
tr_msg (__FILE__, __LINE__, TR_MSG_DBG, NULL, __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
|
||||
|
||||
void* tr_getLog (void);
|
||||
|
||||
/** @brief return true if deep logging has been enabled by the user; false otherwise */
|
||||
bool tr_deepLoggingIsActive (void);
|
||||
|
||||
void tr_deepLog (const char * file,
|
||||
int line,
|
||||
const char * name,
|
||||
const char * fmt,
|
||||
...) TR_GNUC_PRINTF (4, 5) TR_GNUC_NONNULL (1,4);
|
||||
|
||||
/** @brief set the buffer with the current time formatted for deep logging. */
|
||||
char* tr_getLogTimeStr (char * buf, int buflen) TR_GNUC_NONNULL (1);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Rich Salz's classic implementation of shell-style pattern matching for ?, \, [], and * characters.
|
||||
* @return 1 if the pattern matches, 0 if it doesn't, or -1 if an error occured
|
||||
|
||||
Reference in New Issue
Block a user