Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
caisar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
pub
caisar
Commits
c9a7d99a
Commit
c9a7d99a
authored
1 year ago
by
Julien Girard-Satabin
Committed by
Michele Alberti
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
[tests] added support for future multiple logging categories
parent
d1d5f399
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/logging.ml
+3
-3
3 additions, 3 deletions
src/logging.ml
src/logging.mli
+1
-1
1 addition, 1 deletion
src/logging.mli
src/main.ml
+4
-4
4 additions, 4 deletions
src/main.ml
with
8 additions
and
8 deletions
src/logging.ml
+
3
−
3
View file @
c9a7d99a
...
...
@@ -55,12 +55,12 @@ let pp_header =
let
specification_enabled
=
ref
false
let
setup_log
level
categor
y
=
let
setup_log
level
categor
ies
=
Fmt_tty
.
setup_std_outputs
~
style_renderer
:
`Ansi_tty
()
;
Logs
.
set_level
level
;
let
()
=
match
categor
y
with
|
Some
Category
.
Specification
->
specification_enabled
:=
true
match
categor
ies
with
|
Some
[
Category
.
Specification
]
->
specification_enabled
:=
true
|
_
->
()
in
Logs
.
set_reporter
(
Logs_fmt
.
reporter
~
pp_header
()
)
This diff is collapsed.
Click to expand it.
src/logging.mli
+
1
−
1
View file @
c9a7d99a
...
...
@@ -30,4 +30,4 @@ end
val
specification_enabled
:
bool
ref
val
spec_tag
:
unit
->
Logs
.
Tag
.
set
val
setup_log
:
Logs
.
level
option
->
Category
.
t
option
->
unit
val
setup_log
:
Logs
.
level
option
->
Category
.
t
list
option
->
unit
This diff is collapsed.
Click to expand it.
src/main.ml
+
4
−
4
View file @
c9a7d99a
...
...
@@ -36,24 +36,24 @@ let () =
(* -- Logs. *)
let
log_categor
y
=
let
log_categor
ies
=
let
all_categories
=
Logging
.
Category
.
list_available
()
in
let
doc
=
Fmt
.
str
"Logging categories. Available are $(docv)s: %a."
(
Fmt
.
list
~
sep
:
Fmt
.
comma
Fmt
.
string
)
(
List
.
map
~
f
:
Logging
.
Category
.
to_string
all_categories
)
in
let
log_categories
=
let
enum_
log_categories
=
Arg
.
enum
(
List
.
map
~
f
:
(
fun
c
->
(
Logging
.
Category
.
to_string
c
,
c
))
all_categories
)
in
Arg
.(
value
&
opt
(
some
log_categories
)
None
&
opt
(
some
(
list
enum_
log_categories
)
)
None
&
info
[
"c"
;
"log-category"
]
~
doc
~
docv
:
"LOGTAG"
)
let
setup_logs
=
Term
.(
const
Logging
.
setup_log
$
Logs_cli
.
level
()
$
log_categor
y
)
Term
.(
const
Logging
.
setup_log
$
Logs_cli
.
level
()
$
log_categor
ies
)
let
log_level_is_debug
()
=
match
Logs
.
level
()
with
Some
Debug
->
true
|
_
->
false
...
...
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