diff --git a/demo/os/linux/Makefile b/demo/os/linux/Makefile new file mode 100755 index 0000000..25cf136 --- /dev/null +++ b/demo/os/linux/Makefile @@ -0,0 +1,23 @@ +CC = cc + +ROOTPATH=../../.. +INCLUDE = -I./easylogger/inc -I./easylogger/plugins/ -I$(ROOTPATH)/easylogger/plugins/ -I$(ROOTPATH)/easylogger/inc +LIB=-lpthread + +OBJ += $(patsubst %.c, %.o, $(wildcard *.c)) +OBJ += $(patsubst %.c, %.o, $(wildcard $(ROOTPATH)/easylogger/src/*.c)) +OBJ += $(patsubst %.c, %.o, $(wildcard $(ROOTPATH)/easylogger/plugins/file/elog_file.c)) +OBJ += $(patsubst %.c, %.o, $(wildcard easylogger/port/*.c)) +OBJ += $(patsubst %.c, %.o, $(wildcard easylogger/plugins/file/*.c)) + +CFLAGS = -O0 -g3 -Wall +target = EasyLoggerLinuxDemo + +all:$(OBJ) + $(CC) out/*.o -o $(target) $(LIB) + mv $(target) out +%.o:%.c + $(CC) $(CFLAGS) -c $< -o $@ $(INCLUDE) + mv $@ out +clean: + rm -rf out/* diff --git a/demo/os/linux/README.md b/demo/os/linux/README.md index c640d0a..452f983 100644 --- a/demo/os/linux/README.md +++ b/demo/os/linux/README.md @@ -2,23 +2,24 @@ --- -## 1¡¢¼ò½é +## 1ã€ç®€ä»‹ -ʹÓÃGCC±àÒ롣ͨ¹ý `main.c` µÄ `test_elog()` ·½·¨À´²âÊÔÈÕÖ¾µÄÊä³ö¡£ÒÑÔÚ `easylogger\inc\elog_cfg.h` ¿ªÆôÒì²½Êä³öģʽ¡£ +使用GCC编译。通过 `main.c` çš„ `test_elog()` æ–¹æ³•æ¥æµ‹è¯•日志的输出。已在 `easylogger\inc\elog_cfg.h` å¼€å¯å¼‚步输出模å¼ã€‚ -### 1.1¡¢Ê¹Ó÷½·¨ +### 1.1ã€ä½¿ç”¨æ–¹æ³• -ʹÓÃǰÐèÌáǰÅäÖúñàÒë»·¾³£¬ÅäÖóɹ¦ºó£¬Ö´ÐÐ `make.sh` ½Å±¾£¬µÈ´ý±àÒëÍê³Éºó£¬ÔËÐÐ `out\EasyLoggerLinuxDemo` ¼´¿É¿´µ½ÔËÐнá¹û¡£ +使用å‰éœ€æå‰é…置好编译环境,é…ç½®æˆåŠŸåŽï¼Œæ‰§è¡Œ make,等待编译完æˆåŽï¼Œè¿è¡Œ `out\EasyLoggerLinuxDemo` å³å¯çœ‹åˆ°è¿è¡Œç»“果。 -## 2¡¢Îļþ£¨¼Ð£©ËµÃ÷ +## 2ã€æ–‡ä»¶ï¼ˆå¤¹ï¼‰è¯´æ˜Ž -`easylogger\port\elog_port.c` ÒÆÖ²²Î¿¼Îļþ +- `easylogger\port\elog_port.c` ç§»æ¤å‚考文件 +- easylogger\plugins\file\elog_file_port.c File Log功能移æ¤å‚考文件 -## 3¡¢ÆäËû¹¦ÄÜ +## 3ã€å…¶ä»–功能 -¿ÉÒÔ´ò¿ª `main.c` ÖеIJ¿·Ö×¢ÊÍ£¬À´²âÊÔÒÔϹ¦ÄÜ¡£ +å¯ä»¥æ‰“å¼€ `main.c` ä¸­çš„éƒ¨åˆ†æ³¨é‡Šï¼Œæ¥æµ‹è¯•以下功能。 -- `elog_set_output_enabled(false);` £º¶¯Ì¬Ê¹ÄÜ»òʧÄÜÈÕÖ¾Êä³ö -- `elog_set_filter_lvl(ELOG_LVL_WARN);` £º¶¯Ì¬ÉèÖùýÂËÓÅÏȼ¶ -- `elog_set_filter_tag("main");` £º¶¯Ì¬ÉèÖùýÂ˱êÇ© -- `elog_set_filter_kw("Hello");` £º¶¯Ì¬ÉèÖùýÂ˹ؼü´Ê +- `elog_set_output_enabled(false);` :动æ€ä½¿èƒ½æˆ–失能日志输出 +- `elog_set_filter_lvl(ELOG_LVL_WARN);` :动æ€è®¾ç½®è¿‡æ»¤ä¼˜å…ˆçº§ +- `elog_set_filter_tag("main");` :动æ€è®¾ç½®è¿‡æ»¤æ ‡ç­¾ +- `elog_set_filter_kw("Hello");` :动æ€è®¾ç½®è¿‡æ»¤å…³é”®è¯ diff --git a/demo/os/linux/easylogger/inc/elog_cfg.h b/demo/os/linux/easylogger/inc/elog_cfg.h index 52c8081..8f3fa20 100644 --- a/demo/os/linux/easylogger/inc/elog_cfg.h +++ b/demo/os/linux/easylogger/inc/elog_cfg.h @@ -31,6 +31,10 @@ /* enable log output. default open this macro */ #define ELOG_OUTPUT_ENABLE +/* enable log write file. default open this macro */ +#define ELOG_FILE_ENABLE +/* enable flush file cache. default open this macro */ +#define ELOG_FILE_FLUSH_CAHCE_ENABLE /* setting static output log level */ #define ELOG_OUTPUT_LVL ELOG_LVL_VERBOSE /* enable assert check */ diff --git a/demo/os/linux/easylogger/plugins/file/elog_file_cfg.h b/demo/os/linux/easylogger/plugins/file/elog_file_cfg.h new file mode 100644 index 0000000..278b48e --- /dev/null +++ b/demo/os/linux/easylogger/plugins/file/elog_file_cfg.h @@ -0,0 +1,38 @@ +/* + * This file is part of the EasyLogger Library. + * + * Copyright (c) 2015-2019, Qintl, + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * 'Software'), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Function: It is the configure head file for this flash log plugin. + * Created on: 2019-01-05 + */ + +#ifndef _ELOG_FILE_CFG_H_ +#define _ELOG_FILE_CFG_H_ + +/* EasyLogger file log plugin's using file name */ +#define ELOG_FILE_NAME "/tmp/elog_file.log" + +/* EasyLogger file log plugin's using file max size */ +#define ELOG_FILE_MAX_SIZE (10 * 1024 * 1024) + +#endif /* _ELOG_FILE_CFG_H_ */ diff --git a/demo/os/linux/easylogger/plugins/file/elog_file_port.c b/demo/os/linux/easylogger/plugins/file/elog_file_port.c new file mode 100644 index 0000000..74b92e0 --- /dev/null +++ b/demo/os/linux/easylogger/plugins/file/elog_file_port.c @@ -0,0 +1,160 @@ +/* + * This file is part of the EasyLogger Library. + * + * Copyright (c) 2015-2019, Qintl, + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * 'Software'), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Function: Portable interface for EasyLogger's file log pulgin. + * Created on: 2019-01-05 + */ + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#define ELOG_FILE_SEM_KEY ((key_t)0x19910612) +#ifdef _SEM_SEMUN_UNDEFINED +union semun { + int val; /* Value for SETVAL */ + struct semid_ds *buf; /* Buffer for IPC_STAT, IPC_SET */ + unsigned short *array; /* Array for GETALL, SETALL */ + struct seminfo *__buf; /* Buffer for IPC_INFO + (Linux-specific) */ +}; +#endif + +static int semid = -1; +static struct sembuf const up = {0, 1, SEM_UNDO}; +static struct sembuf const down = {0, -1, SEM_UNDO}; + +static void lock_init(void); +static int lock_open(void); +/** + * EasyLogger flile log pulgin port initialize + * + * @return result + */ +ElogErrCode elog_file_port_init(void) { + ElogErrCode result = ELOG_NO_ERR; + + lock_init(); + + return result; +} + +/** + * file log lock + */ +void inline elog_file_port_lock(void) +{ + semid == -1 ? -1 : semop(semid, (struct sembuf *)&down, 1); +} + +/** + * file log unlock + */ +void inline elog_file_port_unlock(void) +{ + semid == -1 ? -1 : semop(semid, (struct sembuf *)&up, 1); +} +/** + * file log deinit + */ +void elog_file_port_deinit(void) +{ + +} + +/** + * initialize the lock + */ +static void lock_init(void) +{ + int id, rc; + union semun arg; + struct sembuf sembuf; + + id = semget(ELOG_FILE_SEM_KEY, 1, IPC_CREAT | IPC_EXCL | 0666); + if(likely(id == -1)) { + id = lock_open(); + if (id == -1) + goto __exit; + } else { + arg.val = 0; + rc = semctl(id, 0, SETVAL, arg); + if (rc == -1) + goto __exit; + + sembuf.sem_num = 0; + sembuf.sem_op = 1; + sembuf.sem_flg = 0; + + rc = semop(semid, &sembuf, 1); + if (rc == -1) + goto __exit; + } + + semid = id; +__exit: + return ; +} + +/** + * gets the lock + */ +static int lock_open(void) +{ + int id, rc, i; + union semun arg; + struct semid_ds ds; + + id = semget(ELOG_FILE_SEM_KEY, 1, 0666); + if(unlikely(id == -1)) + goto err; + + arg.buf = &ds; + + for (i = 0; i < 10; i++) { + rc = semctl(id, 0, IPC_STAT, arg); + if (unlikely(rc == -1)) + goto err; + + if(ds.sem_otime != 0) + break; + + usleep(10 * 1000); + } + + if (unlikely(ds.sem_otime == 0)) + goto err; + + return id; +err: + return -1; +} diff --git a/demo/os/linux/easylogger/port/elog_port.c b/demo/os/linux/easylogger/port/elog_port.c index 4c8c183..0721b05 100644 --- a/demo/os/linux/easylogger/port/elog_port.c +++ b/demo/os/linux/easylogger/port/elog_port.c @@ -32,6 +32,9 @@ #include #include +#ifdef ELOG_FILE_ENABLE +#include +#endif static pthread_mutex_t output_lock; /** @@ -44,6 +47,10 @@ ElogErrCode elog_port_init(void) { pthread_mutex_init(&output_lock, NULL); +#ifdef ELOG_FILE_ENABLE + elog_file_init(); +#endif + return result; } @@ -55,7 +62,11 @@ ElogErrCode elog_port_init(void) { */ void elog_port_output(const char *log, size_t size) { /* output to terminal */ - printf("%.*s", size, log); + printf("%.*s", (int)size, log); +#ifdef ELOG_FILE_ENABLE + /* write the file */ + elog_file_write(log, size); +#endif } /** diff --git a/demo/os/linux/make.sh b/demo/os/linux/make.sh deleted file mode 100755 index 19c6a30..0000000 --- a/demo/os/linux/make.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -gcc -I "easylogger/inc" -I "../../../easylogger/inc" -O0 -g3 -Wall -c "../../../easylogger/src/elog.c" -o "out/elog.o" -gcc -I "easylogger/inc" -I "../../../easylogger/inc" -O0 -g3 -Wall -c "../../../easylogger/src/elog_async.c" -o "out/elog_async.o" -gcc -I "easylogger/inc" -I "../../../easylogger/inc" -O0 -g3 -Wall -c "../../../easylogger/src/elog_buf.c" -o "out/elog_buf.o" -gcc -I "easylogger/inc" -I "../../../easylogger/inc" -O0 -g3 -Wall -c "easylogger/port/elog_port.c" -o "out/elog_port.o" -gcc -I "easylogger/inc" -I "../../../easylogger/inc" -O0 -g3 -Wall -c "../../../easylogger/src/elog_utils.c" -o "out/elog_utils.o" -gcc -I "easylogger/inc" -I "../../../easylogger/inc" -O0 -g3 -Wall -c "main.c" -o "out/main.o" -gcc -o out/EasyLoggerLinuxDemo "out/elog.o" "out/elog_async.o" "out/elog_buf.o" "out/elog_port.o" "out/elog_utils.o" "out/main.o" -lpthread diff --git a/easylogger/plugins/file/elog_file.c b/easylogger/plugins/file/elog_file.c new file mode 100644 index 0000000..e028e50 --- /dev/null +++ b/easylogger/plugins/file/elog_file.c @@ -0,0 +1,102 @@ +/* + * This file is part of the EasyLogger Library. + * + * Copyright (c) 2015-2019, Qintl, + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * 'Software'), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Function: Save log to file. + * Created on: 2019-01-05 + */ + +#include +#include +#include +#include +#include + +#include +#include +/* initialize OK flag */ +static bool init_ok = false; +static FILE *fp; +static int fd; +static Elog_File_Cfg file; + +static void elog_file_config_init(Elog_File_Cfg *file); + +ElogErrCode elog_file_init(void) +{ + ElogErrCode result = ELOG_NO_ERR; + if (init_ok) + goto __exit; + + elog_file_config_init(&file); + + fp = fopen(file.name, "a+"); + if (fp) + fd = fileno(fp); + else + fd = -1; + + elog_file_port_init(); + + init_ok = true; +__exit: + return result; +} + +void elog_file_write(const char *log, size_t size) +{ + ELOG_ASSERT(init_ok); + ELOG_ASSERT(log); + struct stat statbuf; + + statbuf.st_size = 0; + fstat(fd, &statbuf); + + + if (unlikely(statbuf.st_size > file.max_size)) + return ; + + elog_file_port_lock(); + + fwrite(log, size, 1, fp); +#ifdef ELOG_FILE_FLUSH_CAHCE_ENABLE + fflush(fp); + fsync(fd); +#endif + + elog_file_port_unlock(); +} + +void elog_file_deinit(void) +{ + ELOG_ASSERT(init_ok); + + elog_file_port_deinit(); + fclose(fp); +} + +static void elog_file_config_init(Elog_File_Cfg *file) +{ + file->name = ELOG_FILE_NAME; + file->max_size = ELOG_FILE_MAX_SIZE; +} diff --git a/easylogger/plugins/file/elog_file.h b/easylogger/plugins/file/elog_file.h new file mode 100644 index 0000000..4ed1b32 --- /dev/null +++ b/easylogger/plugins/file/elog_file.h @@ -0,0 +1,68 @@ +/* + * This file is part of the EasyLogger Library. + * + * Copyright (c) 2015-2019, Qintl, + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * 'Software'), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Function: It is an head file for file log plugin. You can see all be called functions. + * Created on: 2019-01-05 + */ + +#ifndef __ELOG_FILE__H__ +#define __ELOG_FILE__H__ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* EasyLogger file log plugin's software version number */ +#define ELOG_FILE_SW_VERSION "V1.0.0" +#ifdef linux +#define likely(x) __builtin_expect(!!(x), 1) +#define unlikely(x) __builtin_expect(!!(x), 0) +#else +#define likely(x) (x) +#define unlikely(x) (x) +#endif + +typedef struct { + char *name;/* file name */ + size_t max_size;/* file max size */ +} Elog_File_Cfg; + +/* elog_file.c */ +ElogErrCode elog_file_init(void); +void elog_file_write(const char *log, size_t size); +void elog_file_deinit(void); + +/* elog_file_port.c */ +ElogErrCode elog_file_port_init(void); +void elog_file_port_lock(void); +void elog_file_port_unlock(void); +void elog_file_port_deinit(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/easylogger/plugins/file/elog_file_cfg.h b/easylogger/plugins/file/elog_file_cfg.h new file mode 100644 index 0000000..0dd75c9 --- /dev/null +++ b/easylogger/plugins/file/elog_file_cfg.h @@ -0,0 +1,38 @@ +/* + * This file is part of the EasyLogger Library. + * + * Copyright (c) 2015-2019, Qintl, + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * 'Software'), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Function: It is the configure head file for this flash log plugin. + * Created on: 2019-01-05 + */ + +#ifndef _ELOG_FILE_CFG_H_ +#define _ELOG_FILE_CFG_H_ + +/* EasyLogger file log plugin's using file name */ +#define ELOG_FILE_NAME + +/* EasyLogger file log plugin's using file max size */ +#define ELOG_FILE_MAX_SIZE + +#endif /* _ELOG_FILE_CFG_H_ */ diff --git a/easylogger/plugins/file/elog_file_port.c b/easylogger/plugins/file/elog_file_port.c new file mode 100644 index 0000000..2342df4 --- /dev/null +++ b/easylogger/plugins/file/elog_file_port.c @@ -0,0 +1,89 @@ +/* + * This file is part of the EasyLogger Library. + * + * Copyright (c) 2015-2019, Qintl, + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * 'Software'), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Function: Portable interface for EasyLogger's file log pulgin. + * Created on: 2019-01-05 + */ + +#include "elog_file.h" + +/** + * EasyLogger flile log pulgin port initialize + * + * @return result + */ +ElogErrCode elog_file_port_init(void) +{ + ElogErrCode result = ELOG_NO_ERR; + + /* add your code here */ + + return result; +} + +/** + * flush file cache + */ +void elog_file_port_flush_cache(Elog_File *file) { + + /* add your code here */ + +} + +/** + * get file current size + */ +size_t elog_file_port_get_size(Elog_File *file) +{ + + /* add your code here */ + + return 0; +} + +/** + * file log lock + */ +void elog_file_port_lock(void) { + + /* add your code here */ + +} + +/** + * file log unlock + */ +void elog_file_port_unlock(void) { + + /* add your code here */ + +} +/** + * file log deinit + */ +void elog_file_port_deinit(void) { + + /* add your code here */ + +}