Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
29512b56
Commit
29512b56
authored
10 years ago
by
Nicolas Noble
Browse files
Options
Downloads
Plain Diff
Merge pull request #11 from ctiller/mac
Compile fix for mac
parents
699c0ec2
2d8f790e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/core/support/log_posix.c
+11
-5
11 additions, 5 deletions
src/core/support/log_posix.c
with
11 additions
and
5 deletions
src/core/support/log_posix.c
+
11
−
5
View file @
29512b56
...
...
@@ -31,21 +31,27 @@
*
*/
#define _POSIX_SOURCE
#ifndef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 200112L
#endif
#define _GNU_SOURCE
#include
<grpc/support/port_platform.h>
#if defined(GPR_POSIX_LOG)
#include
<grpc/support/alloc.h>
#include
<grpc/support/log.h>
#include
<grpc/support/time.h>
#include
<stdio.h>
#include
<stdarg.h>
#include
<string.h>
#include
<stdio.h>
#include
<time.h>
#include
<pthread.h>
static
long
gettid
()
{
return
pthread_self
();
}
static
gpr_intptr
gettid
()
{
return
(
gpr_intptr
)
pthread_self
();
}
void
gpr_log
(
const
char
*
file
,
int
line
,
gpr_log_severity
severity
,
const
char
*
format
,
...)
{
...
...
@@ -55,7 +61,7 @@ void gpr_log(const char *file, int line, gpr_log_severity severity,
int
ret
;
va_list
args
;
va_start
(
args
,
format
);
ret
=
vsnprintf
(
buf
,
format
,
args
);
ret
=
vsnprintf
(
buf
,
sizeof
(
buf
),
format
,
args
);
va_end
(
args
);
if
(
ret
<
0
)
{
message
=
NULL
;
...
...
@@ -64,7 +70,7 @@ void gpr_log(const char *file, int line, gpr_log_severity severity,
}
else
{
message
=
allocated
=
gpr_malloc
(
ret
+
1
);
va_start
(
args
,
format
);
vsnprintf
(
message
,
format
,
args
);
vsnprintf
(
message
,
ret
,
format
,
args
);
va_end
(
args
);
}
gpr_log_message
(
file
,
line
,
severity
,
message
);
...
...
@@ -91,7 +97,7 @@ void gpr_default_log(gpr_log_func_args *args) {
strcpy
(
time_buffer
,
"error:strftime"
);
}
fprintf
(
stderr
,
"%s%s.%09d %7
ld
%s:%d] %s
\n
"
,
fprintf
(
stderr
,
"%s%s.%09d %7
tu
%s:%d] %s
\n
"
,
gpr_log_severity_string
(
args
->
severity
),
time_buffer
,
(
int
)(
now
.
tv_nsec
),
gettid
(),
display_file
,
args
->
line
,
args
->
message
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment