Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
M
Mock Turtle
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Mock Turtle
Commits
3341a77e
Commit
3341a77e
authored
Jul 10, 2015
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wrtd:tools: show all log levels in logging application
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
e9cbc85d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
1 deletion
+33
-1
wrtd-logging.c
applications/wrtd/tools/wrtd-logging.c
+33
-1
No files found.
applications/wrtd/tools/wrtd-logging.c
View file @
3341a77e
...
...
@@ -21,6 +21,7 @@ static void help()
fprintf
(
stderr
,
"It shows logging information coming from Real-Time applications
\n
"
);
fprintf
(
stderr
,
"-D device id
\n
"
);
fprintf
(
stderr
,
"-n number of messages to read (0 means infinite)
\n
"
);
fprintf
(
stderr
,
"-s show current logging level for all channels
\n
"
);
exit
(
1
);
}
...
...
@@ -49,12 +50,34 @@ static int print_message(struct wrnc_hmq *hmq)
return
0
;
}
static
void
show_logging_level
(
struct
wrtd_node
*
dev
,
enum
wrtd_core
core
)
{
uint32_t
log_level
;
char
log_level_str
[
128
];
int
i
,
err
,
max
=
core
?
FD_NUM_CHANNELS
:
TDC_NUM_CHANNELS
;
fprintf
(
stdout
,
"%s log levels
\n
"
,
core
?
"Output"
:
"Input"
);
for
(
i
=
0
;
i
<
max
;
i
++
)
{
if
(
core
)
err
=
wrtd_out_log_level_get
(
dev
,
i
,
&
log_level
);
else
err
=
wrtd_in_log_level_get
(
dev
,
i
,
&
log_level
);
if
(
err
)
{
fprintf
(
stdout
,
"
\t
channel %d: --- ERROR ---
\n
"
,
i
);
}
else
{
wrtd_strlogging_full
(
log_level_str
,
log_level
);
fprintf
(
stdout
,
"
\t
channel %d: %s
\n
"
,
i
,
log_level_str
);
}
}
}
#define N_LOG 2
int
main
(
int
argc
,
char
*
argv
[])
{
struct
wrnc_hmq
*
log
[
N_LOG
];
struct
pollfd
p
[
N_LOG
];
/* each node has 2 logging channels (in, out) */
int
n
=
0
,
i
=
0
,
ret
,
k
,
err
,
chan
=
-
1
;
int
n
=
0
,
i
=
0
,
ret
,
k
,
err
,
chan
=
-
1
,
show_log
=
0
;
struct
wrtd_node
*
wrtd
;
uint32_t
dev_id
=
0
;
char
c
;
...
...
@@ -70,6 +93,9 @@ int main(int argc, char *argv[])
case
'n'
:
sscanf
(
optarg
,
"0x%x"
,
&
n
);
break
;
case
's'
:
show_log
=
1
;
break
;
}
}
...
...
@@ -90,6 +116,12 @@ int main(int argc, char *argv[])
exit
(
1
);
}
if
(
show_log
)
{
show_logging_level
(
wrtd
,
WRTD_CORE_IN
);
show_logging_level
(
wrtd
,
WRTD_CORE_OUT
);
exit
(
0
);
}
/* Open logging interfaces */
log
[
0
]
=
wrtd_in_log_open
(
wrtd
,
WRTD_LOG_ALL
,
chan
);
if
(
!
log
[
0
])
{
...
...
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