1
0
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:
armink 2015-07-28 10:48:11 +08:00
parent 110b2f46de
commit 945bb590aa
6 changed files with 93 additions and 40 deletions

View File

@ -47,10 +47,13 @@ ElogErrCode elog_port_init(void) {
/** /**
* output log port interface * 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 */ /* output to terminal */
rt_kprintf("%.*s", size, output); rt_kprintf("%.*s", size, log);
//TODO output to flash //TODO output to flash
} }

View File

@ -64,7 +64,7 @@ enum {
/* output newline sign */ /* output newline sign */
#define ELOG_NEWLINE_SIGN "\r\n" #define ELOG_NEWLINE_SIGN "\r\n"
/* EasyLogger software version number */ /* EasyLogger software version number */
#define ELOG_SW_VERSION "0.07.25" #define ELOG_SW_VERSION "0.07.28"
/* EasyLogger assert for developer. */ /* EasyLogger assert for developer. */
#define ELOG_ASSERT(EXPR) \ #define ELOG_ASSERT(EXPR) \
@ -195,7 +195,7 @@ size_t elog_strcpy(size_t cur_len, char *dst, const char *src);
/* elog_port.c */ /* elog_port.c */
ElogErrCode elog_port_init(void); 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_lock(void);
void elog_port_output_unlock(void); void elog_port_output_unlock(void);
const char *elog_port_get_time(void); const char *elog_port_get_time(void);

View File

@ -58,7 +58,7 @@ static void log_buf_lock(void);
static void log_buf_unlock(void); static void log_buf_unlock(void);
/** /**
* EasyLogger flash save plugin initialize. * EasyLogger flash log plugin initialize.
* *
* @return result * @return result
*/ */
@ -73,6 +73,8 @@ ElogErrCode elog_flash_init(void) {
cur_buf_size = 0; cur_buf_size = 0;
#endif #endif
/* port initialize */
elog_flash_port_init();
/* initialize OK */ /* initialize OK */
init_ok = true; init_ok = true;

View File

@ -35,12 +35,12 @@
extern "C" { extern "C" {
#endif #endif
/* EasyLogger flash save plugin's using buffer mode */ /* EasyLogger flash log plugin's using buffer mode */
#define ELOG_FLASH_USING_BUF_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 #define ELOG_FLASH_BUF_SIZE 1024
/* EasyLogger flash save plugin's software version number */ /* EasyLogger flash log plugin's software version number */
#define ELOG_FLASH_SW_VERSION "0.07.04" #define ELOG_FLASH_SW_VERSION "0.07.28"
/* elog_flash.c */ /* elog_flash.c */
ElogErrCode elog_flash_init(void); ElogErrCode elog_flash_init(void);
@ -56,8 +56,9 @@ void elog_flash_lock_enabled(bool enabled);
void elog_flash_flush(void); void elog_flash_flush(void);
#endif #endif
/* elog_port.c */ /* elog_flash_port.c */
void elog_flash_port_output(const char *output, size_t size); 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_lock(void);
void elog_flash_port_unlock(void); void elog_flash_port_unlock(void);

View 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 */
}

View File

@ -45,22 +45,16 @@ ElogErrCode elog_port_init(void) {
/** /**
* output log port interface * 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 */ /* 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 * 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 * get current time interface
* *