Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
85efe896
Commit
85efe896
authored
Nov 27, 2019
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: display trace level with prefix in tests
parent
625a3a49
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
8 deletions
+24
-8
tests/clar_libgit2_trace.c
+24
-8
No files found.
tests/clar_libgit2_trace.c
View file @
85efe896
...
@@ -10,26 +10,42 @@ struct method {
...
@@ -10,26 +10,42 @@ struct method {
void
(
*
close
)(
void
);
void
(
*
close
)(
void
);
};
};
static
const
char
*
message_prefix
(
git_trace_level_t
level
)
{
switch
(
level
)
{
case
GIT_TRACE_NONE
:
return
"[NONE]: "
;
case
GIT_TRACE_FATAL
:
return
"[FATAL]: "
;
case
GIT_TRACE_ERROR
:
return
"[ERROR]: "
;
case
GIT_TRACE_WARN
:
return
"[WARN]: "
;
case
GIT_TRACE_INFO
:
return
"[INFO]: "
;
case
GIT_TRACE_DEBUG
:
return
"[DEBUG]: "
;
case
GIT_TRACE_TRACE
:
return
"[TRACE]: "
;
default:
return
"[?????]: "
;
}
}
#if defined(GIT_TRACE)
#if defined(GIT_TRACE)
static
void
_git_trace_cb__printf
(
git_trace_level_t
level
,
const
char
*
msg
)
static
void
_git_trace_cb__printf
(
git_trace_level_t
level
,
const
char
*
msg
)
{
{
/* TODO Use level to print a per-message prefix. */
printf
(
"%s%s
\n
"
,
message_prefix
(
level
),
msg
);
GIT_UNUSED
(
level
);
printf
(
"%s
\n
"
,
msg
);
}
}
#if defined(GIT_WIN32)
#if defined(GIT_WIN32)
static
void
_git_trace_cb__debug
(
git_trace_level_t
level
,
const
char
*
msg
)
static
void
_git_trace_cb__debug
(
git_trace_level_t
level
,
const
char
*
msg
)
{
{
/* TODO Use level to print a per-message prefix. */
OutputDebugString
(
message_prefix
(
level
));
GIT_UNUSED
(
level
);
OutputDebugString
(
msg
);
OutputDebugString
(
msg
);
OutputDebugString
(
"
\n
"
);
OutputDebugString
(
"
\n
"
);
printf
(
"%s
\n
"
,
msg
);
printf
(
"%s
%s
\n
"
,
message_prefix
(
level
)
,
msg
);
}
}
#else
#else
#define _git_trace_cb__debug _git_trace_cb__printf
#define _git_trace_cb__debug _git_trace_cb__printf
...
...
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