mirror of
https://github.com/armink/EasyLogger.git
synced 2025-01-31 21:42:53 +08:00
1、【完善】源码文件结构,将插件目录独立出来。
Signed-off-by: armink <armink.ztl@gmail.com>
This commit is contained in:
parent
110b2f46de
commit
945bb590aa
@ -47,10 +47,13 @@ ElogErrCode elog_port_init(void) {
|
||||
|
||||
/**
|
||||
* output log port interface
|
||||
*
|
||||
* @param log output of log
|
||||
* @param size log size
|
||||
*/
|
||||
void elog_port_output(const char *output, size_t size) {
|
||||
void elog_port_output(const char *log, size_t size) {
|
||||
/* output to terminal */
|
||||
rt_kprintf("%.*s", size, output);
|
||||
rt_kprintf("%.*s", size, log);
|
||||
//TODO output to flash
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ enum {
|
||||
/* output newline sign */
|
||||
#define ELOG_NEWLINE_SIGN "\r\n"
|
||||
/* EasyLogger software version number */
|
||||
#define ELOG_SW_VERSION "0.07.25"
|
||||
#define ELOG_SW_VERSION "0.07.28"
|
||||
|
||||
/* EasyLogger assert for developer. */
|
||||
#define ELOG_ASSERT(EXPR) \
|
||||
@ -195,7 +195,7 @@ size_t elog_strcpy(size_t cur_len, char *dst, const char *src);
|
||||
|
||||
/* elog_port.c */
|
||||
ElogErrCode elog_port_init(void);
|
||||
void elog_port_output(const char *output, size_t size);
|
||||
void elog_port_output(const char *log, size_t size);
|
||||
void elog_port_output_lock(void);
|
||||
void elog_port_output_unlock(void);
|
||||
const char *elog_port_get_time(void);
|
||||
|
@ -58,7 +58,7 @@ static void log_buf_lock(void);
|
||||
static void log_buf_unlock(void);
|
||||
|
||||
/**
|
||||
* EasyLogger flash save plugin initialize.
|
||||
* EasyLogger flash log plugin initialize.
|
||||
*
|
||||
* @return result
|
||||
*/
|
||||
@ -73,6 +73,8 @@ ElogErrCode elog_flash_init(void) {
|
||||
cur_buf_size = 0;
|
||||
#endif
|
||||
|
||||
/* port initialize */
|
||||
elog_flash_port_init();
|
||||
/* initialize OK */
|
||||
init_ok = true;
|
||||
|
@ -35,12 +35,12 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* EasyLogger flash save plugin's using buffer mode */
|
||||
/* EasyLogger flash log plugin's using buffer mode */
|
||||
#define ELOG_FLASH_USING_BUF_MODE
|
||||
/* EasyLogger flash save plugin's RAM buffer size */
|
||||
/* EasyLogger flash log plugin's RAM buffer size */
|
||||
#define ELOG_FLASH_BUF_SIZE 1024
|
||||
/* EasyLogger flash save plugin's software version number */
|
||||
#define ELOG_FLASH_SW_VERSION "0.07.04"
|
||||
/* EasyLogger flash log plugin's software version number */
|
||||
#define ELOG_FLASH_SW_VERSION "0.07.28"
|
||||
|
||||
/* elog_flash.c */
|
||||
ElogErrCode elog_flash_init(void);
|
||||
@ -56,8 +56,9 @@ void elog_flash_lock_enabled(bool enabled);
|
||||
void elog_flash_flush(void);
|
||||
#endif
|
||||
|
||||
/* elog_port.c */
|
||||
void elog_flash_port_output(const char *output, size_t size);
|
||||
/* elog_flash_port.c */
|
||||
ElogErrCode elog_flash_port_init(void);
|
||||
void elog_flash_port_output(const char *log, size_t size);
|
||||
void elog_flash_port_lock(void);
|
||||
void elog_flash_port_unlock(void);
|
||||
|
72
easylogger/plugins/flash/elog_flash_port.c
Normal file
72
easylogger/plugins/flash/elog_flash_port.c
Normal file
@ -0,0 +1,72 @@
|
||||
/*
|
||||
* This file is part of the EasyLogger Library.
|
||||
*
|
||||
* Copyright (c) 2015, Armink, <armink.ztl@gmail.com>
|
||||
*
|
||||
* 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 flash log pulgin.
|
||||
* Created on: 2015-07-28
|
||||
*/
|
||||
|
||||
#include "elog_flash.h"
|
||||
|
||||
/**
|
||||
* EasyLogger flash log pulgin port initialize
|
||||
*
|
||||
* @return result
|
||||
*/
|
||||
ElogErrCode elog_flash_port_init(void) {
|
||||
ElogErrCode result = ELOG_NO_ERR;
|
||||
|
||||
/* add your code here */
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* output flash saved log port interface
|
||||
*
|
||||
* @param log flash saved log
|
||||
* @param size log size
|
||||
*/
|
||||
void elog_flash_port_output(const char *log, size_t size) {
|
||||
|
||||
/* add your code here */
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* flash log lock
|
||||
*/
|
||||
void elog_flash_port_lock(void) {
|
||||
|
||||
/* add your code here */
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* flash log unlock
|
||||
*/
|
||||
void elog_flash_port_unlock(void) {
|
||||
|
||||
/* add your code here */
|
||||
|
||||
}
|
@ -45,22 +45,16 @@ ElogErrCode elog_port_init(void) {
|
||||
|
||||
/**
|
||||
* output log port interface
|
||||
*
|
||||
* @param log output of log
|
||||
* @param size log size
|
||||
*/
|
||||
void elog_port_output(const char *output, size_t size) {
|
||||
void elog_port_output(const char *log, size_t size) {
|
||||
|
||||
/* add your code here */
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* output flash saved log port interface
|
||||
*/
|
||||
void elog_flash_port_output(const char *output, size_t size) {
|
||||
|
||||
/* If used flash log plugin, then you must implement this function. */
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* output lock
|
||||
*/
|
||||
@ -79,25 +73,6 @@ void elog_port_output_unlock(void) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* flash log lock
|
||||
*/
|
||||
void elog_flash_port_lock(void) {
|
||||
|
||||
/* If used flash log plugin, then you must implement this function. */
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* flash log unlock
|
||||
*/
|
||||
void elog_flash_port_unlock(void) {
|
||||
|
||||
/* If used flash log plugin, then you must implement this function. */
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get current time interface
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user