Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongoose
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
mongoose
Commits
9eea072f
Commit
9eea072f
authored
9 years ago
by
Deomid Ryabkov
Committed by
rojer
9 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add optional log of timestamp difference
PUBLISHED_FROM=046ac695f1c771ab156bdd950a8d5cbecbf65bfa
parent
aa2ff674
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
0 deletions
+20
-0
mongoose.c
mongoose.c
+16
-0
mongoose.h
mongoose.h
+4
-0
No files found.
mongoose.c
View file @
9eea072f
...
@@ -339,6 +339,8 @@ int cs_base64_decode(const unsigned char *s, int len, char *dst) {
...
@@ -339,6 +339,8 @@ int cs_base64_decode(const unsigned char *s, int len, char *dst) {
#include <stdarg.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdio.h>
/* Amalgamated: #include "common/cs_time.h" */
enum
cs_log_level
s_cs_log_level
=
enum
cs_log_level
s_cs_log_level
=
#ifdef CS_ENABLE_DEBUG
#ifdef CS_ENABLE_DEBUG
LL_VERBOSE_DEBUG
;
LL_VERBOSE_DEBUG
;
...
@@ -346,19 +348,33 @@ enum cs_log_level s_cs_log_level =
...
@@ -346,19 +348,33 @@ enum cs_log_level s_cs_log_level =
LL_ERROR
;
LL_ERROR
;
#endif
#endif
#ifdef CS_LOG_TS_DIFF
double
cs_log_ts
;
#endif
#ifndef CS_DISABLE_STDIO
#ifndef CS_DISABLE_STDIO
void
cs_log_printf
(
const
char
*
fmt
,
...)
{
void
cs_log_printf
(
const
char
*
fmt
,
...)
{
va_list
ap
;
va_list
ap
;
#ifdef CS_LOG_TS_DIFF
double
now
=
cs_time
();
fprintf
(
stderr
,
"%7u "
,
(
unsigned
int
)
((
now
-
cs_log_ts
)
*
1000000
));
#endif
va_start
(
ap
,
fmt
);
va_start
(
ap
,
fmt
);
vfprintf
(
stderr
,
fmt
,
ap
);
vfprintf
(
stderr
,
fmt
,
ap
);
va_end
(
ap
);
va_end
(
ap
);
fputc
(
'\n'
,
stderr
);
fputc
(
'\n'
,
stderr
);
#ifdef CS_LOG_TS_DIFF
cs_log_ts
=
now
;
#endif
fflush
(
stderr
);
fflush
(
stderr
);
}
}
#endif
/* !CS_DISABLE_STDIO */
#endif
/* !CS_DISABLE_STDIO */
void
cs_log_set_level
(
enum
cs_log_level
level
)
{
void
cs_log_set_level
(
enum
cs_log_level
level
)
{
s_cs_log_level
=
level
;
s_cs_log_level
=
level
;
#ifdef CS_LOG_TS_DIFF
cs_log_ts
=
cs_time
();
#endif
}
}
#ifdef MG_MODULE_LINES
#ifdef MG_MODULE_LINES
#line 0 "./src/../../common/cs_dirent.c"
#line 0 "./src/../../common/cs_dirent.c"
...
...
This diff is collapsed.
Click to expand it.
mongoose.h
View file @
9eea072f
...
@@ -565,6 +565,10 @@ void cs_log_set_level(enum cs_log_level level);
...
@@ -565,6 +565,10 @@ void cs_log_set_level(enum cs_log_level level);
#ifndef CS_DISABLE_STDIO
#ifndef CS_DISABLE_STDIO
#ifdef CS_LOG_TS_DIFF
extern
double
cs_log_ts
;
#endif
void
cs_log_printf
(
const
char
*
fmt
,
...);
void
cs_log_printf
(
const
char
*
fmt
,
...);
#define LOG(l, x) \
#define LOG(l, x) \
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment