summaryrefslogtreecommitdiff
path: root/components/utilities
diff options
context:
space:
mode:
authorbernard <[email protected]>2013-10-10 00:22:59 +0900
committerbernard <[email protected]>2013-10-10 00:22:59 +0900
commit1ffb99e6f58d2ba8d9e0f0cfba2bbb158c0ecee7 (patch)
treec5e438f5db85072b981923d64572cdb763ca4372 /components/utilities
parentf1107f6714a2d6e53f94c957fb352846407c56f9 (diff)
parent83bb05419f7aba80f6a10a48f88a2838a356737a (diff)
Merge branch 'master' of https://github.com/RT-Thread/rt-thread
Diffstat (limited to 'components/utilities')
-rw-r--r--components/utilities/logtrace/log_file.c3
-rw-r--r--components/utilities/logtrace/log_trace.c4
-rw-r--r--components/utilities/logtrace/log_trace.h18
3 files changed, 15 insertions, 10 deletions
diff --git a/components/utilities/logtrace/log_file.c b/components/utilities/logtrace/log_file.c
index 72e4724b63..2f4a28b63c 100644
--- a/components/utilities/logtrace/log_file.c
+++ b/components/utilities/logtrace/log_file.c
@@ -121,6 +121,9 @@ void log_trace_set_file(const char *filename)
log_trace_file_init(filename);
log_trace_set_device("logfile");
}
+#ifdef RT_USING_FINSH
+#include <finsh.h>
FINSH_FUNCTION_EXPORT_ALIAS(log_trace_set_file, log_file, set output filename of log trace);
+#endif
#endif /* RT_USING_DFS */
diff --git a/components/utilities/logtrace/log_trace.c b/components/utilities/logtrace/log_trace.c
index 79d5a21884..cc55b1dd44 100644
--- a/components/utilities/logtrace/log_trace.c
+++ b/components/utilities/logtrace/log_trace.c
@@ -41,7 +41,7 @@ static struct rt_device _log_device;
static rt_device_t _traceout_device = RT_NULL;
/* define a default lg session. The name is empty. */
-static struct log_trace_session _def_session = {{0}, LOG_TRACE_LEVEL_INFO};
+static struct log_trace_session _def_session = {{"\0"}, LOG_TRACE_LEVEL_INFO};
static struct log_trace_session *_the_sessions[LOG_TRACE_MAX_SESSION] = {&_def_session};
/* there is a default session at least */
static rt_uint16_t _the_sess_nr = 1;
@@ -272,7 +272,7 @@ static void _lg_fmtout(
_trace_buf[0] = ']';
ptr = &_trace_buf[1];
- length = vsnprintf(ptr, LOG_TRACE_BUFSZ, fmt, argptr);
+ length = rt_vsnprintf(ptr, LOG_TRACE_BUFSZ, fmt, argptr);
if (length >= LOG_TRACE_BUFSZ)
length = LOG_TRACE_BUFSZ - 1;
diff --git a/components/utilities/logtrace/log_trace.h b/components/utilities/logtrace/log_trace.h
index d5a028f553..77e1f08b6c 100644
--- a/components/utilities/logtrace/log_trace.h
+++ b/components/utilities/logtrace/log_trace.h
@@ -31,9 +31,10 @@
#define LOG_TRACE_LEVEL_MASK 0x0f
#define LOG_TRACE_LEVEL_NOTRACE 0x00
#define LOG_TRACE_LEVEL_ERROR 0x01
-#define LOG_TRACE_LEVEL_WARNING 0x02
-#define LOG_TRACE_LEVEL_INFO 0x03
-#define LOG_TRACE_LEVEL_DEBUG 0x04
+#define LOG_TRACE_LEVEL_WARNING 0x03
+#define LOG_TRACE_LEVEL_INFO 0x05
+#define LOG_TRACE_LEVEL_VERBOSE 0x07
+#define LOG_TRACE_LEVEL_DEBUG 0x09
#define LOG_TRACE_LEVEL_ALL 0x0f
#ifndef LOG_TRACE_LEVEL_DEFAULT
@@ -41,9 +42,10 @@
#endif
#define LOG_TRACE_ERROR "<1>"
-#define LOG_TRACE_WARNING "<2>"
-#define LOG_TRACE_INFO "<3>"
-#define LOG_TRACE_DEBUG "<4>"
+#define LOG_TRACE_WARNING "<3>"
+#define LOG_TRACE_INFO "<5>"
+#define LOG_TRACE_VERBOSE "<7>"
+#define LOG_TRACE_DEBUG "<9>"
#define LOG_TRACE_OPT_NOTS 0x10 /* no timestamp */
#define LOG_TRACE_OPT_LN 0x20 /* terminate the current line */
@@ -140,12 +142,12 @@ rt_err_t log_trace_set_device(const char *device_name);
void log_trace_flush(void);
+#ifdef RT_USING_DFS
/** set the backend to file */
void log_trace_set_file(const char *filename);
-/* log trace for NAND Flash */
-void log_trace_nand_init(const char *nand_device);
void log_trace_file_init(const char *filename);
+#endif /* RT_USING_DFS */
#endif