forked from lei.chen/myxce
use clang-format to format code
This commit is contained in:
parent
2bad284582
commit
de090dce35
58 changed files with 8745 additions and 7237 deletions
|
|
@ -55,7 +55,8 @@ typedef uint64_t jobid_t;
|
|||
#define MAX_APISERVER_ID (UMAX_BITS(N_APISERVER_ID_BITS))
|
||||
#define MAX_ARRAY_IDX (UMAX_BITS(N_ARRAY_IDX_BITS))
|
||||
|
||||
#define REGEX_JOBID "[ \t]*([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)[ \t]*"
|
||||
#define REGEX_JOBARRAY_ID "[ \t]*([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)\\[([0-9]+)\\][ \t]*"
|
||||
#define REGEX_JOBID "[ \t]*([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)[ \t]*"
|
||||
#define REGEX_JOBARRAY_ID \
|
||||
"[ \t]*([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)\\[([0-9]+)\\][ \t]*"
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -4,26 +4,24 @@
|
|||
#include "tlog.h"
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
static pthread_mutex_t log_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
static int xce_log_initialized = 0;
|
||||
static pthread_mutex_t log_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
static int xce_log_initialized = 0;
|
||||
|
||||
typedef enum {
|
||||
XCE_LOG_DEBUG3 = TLOG_DEBUG3,
|
||||
XCE_LOG_DEBUG2 = TLOG_DEBUG2,
|
||||
XCE_LOG_DEBUG = TLOG_DEBUG,
|
||||
XCE_LOG_INFO = TLOG_INFO,
|
||||
XCE_LOG_NOTICE = TLOG_NOTICE,
|
||||
XCE_LOG_WARN = TLOG_WARN,
|
||||
XCE_LOG_ERROR = TLOG_ERROR,
|
||||
XCE_LOG_FATAL = TLOG_FATAL,
|
||||
XCE_LOG_OFF = TLOG_OFF,
|
||||
XCE_LOG_END = TLOG_END
|
||||
XCE_LOG_DEBUG3 = TLOG_DEBUG3,
|
||||
XCE_LOG_DEBUG2 = TLOG_DEBUG2,
|
||||
XCE_LOG_DEBUG = TLOG_DEBUG,
|
||||
XCE_LOG_INFO = TLOG_INFO,
|
||||
XCE_LOG_NOTICE = TLOG_NOTICE,
|
||||
XCE_LOG_WARN = TLOG_WARN,
|
||||
XCE_LOG_ERROR = TLOG_ERROR,
|
||||
XCE_LOG_FATAL = TLOG_FATAL,
|
||||
XCE_LOG_OFF = TLOG_OFF,
|
||||
XCE_LOG_END = TLOG_END
|
||||
} LogLevel;
|
||||
|
||||
static inline int xce_init_xcecd_log(const char* log_file,
|
||||
int log_size,
|
||||
int log_level)
|
||||
static inline int xce_init_xcecd_log(const char* log_file, int log_size,
|
||||
int log_level)
|
||||
{
|
||||
int ret;
|
||||
pthread_mutex_lock(&log_mutex);
|
||||
|
|
@ -41,8 +39,7 @@ static inline int xce_init_xcecd_log(const char* log_file,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static inline int xce_init_xcecdwk_log(const char* log_file,
|
||||
int log_size,
|
||||
static inline int xce_init_xcecdwk_log(const char* log_file, int log_size,
|
||||
int log_level)
|
||||
{
|
||||
int ret;
|
||||
|
|
@ -61,33 +58,28 @@ static inline int xce_init_xcecdwk_log(const char* log_file,
|
|||
return 0;
|
||||
}
|
||||
|
||||
#define XCECD_LOG(level, format, ...) \
|
||||
do { \
|
||||
pthread_mutex_lock(&log_mutex); \
|
||||
tlog((int)(level), \
|
||||
format \
|
||||
__VA_OPT__(,) __VA_ARGS__); \
|
||||
pthread_mutex_unlock(&log_mutex); \
|
||||
} while(0)
|
||||
|
||||
#define XCECD_WORKER_LOG(level, format, ...) \
|
||||
do { \
|
||||
pthread_mutex_lock(&log_mutex); \
|
||||
tlog((int)(level), \
|
||||
format \
|
||||
__VA_OPT__(,) __VA_ARGS__); \
|
||||
pthread_mutex_unlock(&log_mutex); \
|
||||
} while(0)
|
||||
#define XCECD_LOG(level, format, ...) \
|
||||
do { \
|
||||
pthread_mutex_lock(&log_mutex); \
|
||||
tlog((int)(level), format __VA_OPT__(, ) __VA_ARGS__); \
|
||||
pthread_mutex_unlock(&log_mutex); \
|
||||
} while (0)
|
||||
|
||||
#define XCECD_WORKER_LOG(level, format, ...) \
|
||||
do { \
|
||||
pthread_mutex_lock(&log_mutex); \
|
||||
tlog((int)(level), format __VA_OPT__(, ) __VA_ARGS__); \
|
||||
pthread_mutex_unlock(&log_mutex); \
|
||||
} while (0)
|
||||
|
||||
/* For different XCE modules we can have customized macros. Here is an example
|
||||
* of XCECD log micro.
|
||||
* of XCECD log micro.
|
||||
*/
|
||||
#define CONTROLLER_LOG(level, format, ...) tlog((int)level, format __VA_OPT__(,)__VA_ARGS__)
|
||||
#define SCHEDULER_LOG(level, format, ...) tlog((int)level, format __VA_OPT__(,)__VA_ARGS__)
|
||||
#define CONTROLLER_LOG(level, format, ...) \
|
||||
tlog((int)level, format __VA_OPT__(, ) __VA_ARGS__)
|
||||
#define SCHEDULER_LOG(level, format, ...) \
|
||||
tlog((int)level, format __VA_OPT__(, ) __VA_ARGS__)
|
||||
|
||||
static inline void xce_log_fini() {
|
||||
tlog_exit();
|
||||
}
|
||||
static inline void xce_log_fini() { tlog_exit(); }
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue