Commit e4dd43f1 authored by Hardy Simpson's avatar Hardy Simpson

code: smooth

parent b28a40bb
......@@ -1452,7 +1452,7 @@ reference "ite:同步IO文件"
\end_layout
\begin_layout Standard
(level int)必须在[1,253]这个范围内,越大越重要。(syslog level)是可选的,如果不设默认为LOG_DEBUG。
(level int)必须在[1,253]这个范围内,越大越重要。(syslog level)是可选的,如果不设默认为LOG_DEBUG。
\end_layout
\begin_layout Standard
......
......@@ -2,12 +2,12 @@
using makefile.linux for test, libzlog compile in O2
-------------------------------------------------
[direct write, no logging library] - The Sky!
$ time ./test_press_printf 1 10 100000
$ time ./test_press_fwrite 1 10 100000
real 0m0.227s
user 0m0.070s
sys 0m0.180s
$ time ./test_press_printf2 1 10 100000
$ time ./test_press_fwrite2 1 10 100000
real 0m0.123s
user 0m0.060s
sys 0m0.130s
......
......@@ -21,7 +21,6 @@
#define __zlog_buf_h
#include <stdarg.h>
#include <time.h>
#include <stdint.h>
typedef struct zlog_buf_s {
......@@ -38,11 +37,19 @@ typedef struct zlog_buf_s {
size_t truncate_str_len;
} zlog_buf_t;
zlog_buf_t *zlog_buf_new(size_t buf_size_min, size_t buf_size_max,
const char *truncate_str);
zlog_buf_t *zlog_buf_new(size_t min, size_t max, const char *truncate_str);
void zlog_buf_del(zlog_buf_t * a_buf);
void zlog_buf_profile(zlog_buf_t * a_buf, int flag);
int zlog_buf_vprintf(zlog_buf_t * a_buf, const char *format, va_list args);
int zlog_buf_append(zlog_buf_t * a_buf, const char *str, size_t str_len);
int zlog_buf_adjust_append(zlog_buf_t * a_buf, const char *str, size_t str_len,
int left_adjust, size_t in_width, size_t out_width);
int zlog_buf_printf_dec32(zlog_buf_t * a_buf, uint32_t ui32, int width);
int zlog_buf_printf_dec64(zlog_buf_t * a_buf, uint64_t ui64, int width);
int zlog_buf_printf_hex(zlog_buf_t * a_buf, uint32_t ui32, int width);
#define zlog_buf_restart(a_buf) do { \
a_buf->tail = a_buf->start; \
} while(0)
......@@ -51,16 +58,4 @@ void zlog_buf_profile(zlog_buf_t * a_buf, int flag);
#define zlog_buf_str(a_buf) (a_buf->start)
#define zlog_buf_seal(a_buf) do {*(a_buf)->tail = '\0';} while (0)
int zlog_buf_vprintf(zlog_buf_t * a_buf, const char *format, va_list args);
int zlog_buf_append(zlog_buf_t * a_buf, const char *str, size_t str_len);
int zlog_buf_adjust_append(zlog_buf_t * a_buf, const char *str, size_t str_len,
int left_adjust, size_t min_width, size_t max_width);
int zlog_buf_printf_num(zlog_buf_t * a_buf, uint64_t ui64, int is_hex, int width);
int zlog_buf_printf_dec32(zlog_buf_t * a_buf, uint32_t ui32, int width);
int zlog_buf_printf_dec64(zlog_buf_t * a_buf, uint64_t ui64, int width);
int zlog_buf_printf_hex(zlog_buf_t * a_buf, uint32_t ui32, int width);
#endif
......@@ -40,7 +40,6 @@ int zlog_category_update_rules(zlog_category_t * a_category, zc_arraylist_t * ne
void zlog_category_commit_rules(zlog_category_t * a_category);
void zlog_category_rollback_rules(zlog_category_t * a_category);
int zlog_category_output(zlog_category_t * a_category, zlog_thread_t * a_thread);
#define zlog_category_needless_level(a_category, lv) \
......
......@@ -27,7 +27,6 @@ zc_hashtable_t *zlog_category_table_new(void);
void zlog_category_table_del(zc_hashtable_t * categories);
void zlog_category_table_profile(zc_hashtable_t * categories, int flag);
/* if none, create new and return */
zlog_category_t *zlog_category_table_fetch_category(
zc_hashtable_t * categories,
......
......@@ -17,8 +17,8 @@ noinst_PROGRAMS = \
test_press_zlog \
test_press_zlog2 \
test_press_syslog \
test_press_printf \
test_press_printf2 \
test_press_fwrite \
test_press_fwrite2 \
test_syslog \
test_conf \
test_mdc \
......@@ -38,8 +38,8 @@ test_hex_SOURCES = test_hex.c
test_init_SOURCES = test_init.c
test_press_zlog_SOURCES = test_press_zlog.c
test_press_zlog2_SOURCES = test_press_zlog2.c
test_press_printf_SOURCES = test_press_printf.c
test_press_printf2_SOURCES = test_press_printf2.c
test_press_fwrite_SOURCES = test_press_fwrite.c
test_press_fwrite2_SOURCES = test_press_fwrite2.c
test_press_syslog_SOURCES = test_press_syslog.c
test_syslog_SOURCES = test_syslog.c
test_mdc_SOURCES = test_mdc.c
......
......@@ -13,8 +13,8 @@ exe = \
test_record \
test_press_zlog \
test_press_zlog2 \
test_press_printf \
test_press_printf2 \
test_press_fwrite \
test_press_fwrite2 \
test_press_syslog \
test_syslog \
test_default \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment