Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Macao Legacy
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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MACAO
Macao Legacy
Commits
1c69742d
Commit
1c69742d
authored
11 months ago
by
Eliott Sammier
Browse files
Options
Downloads
Patches
Plain Diff
Add log level parameter as env var
parent
f69944da
Branches
Branches containing commit
No related tags found
1 merge request
!1
Main
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tetras_extraction/script/src/common.py
+19
-2
19 additions, 2 deletions
tetras_extraction/script/src/common.py
with
19 additions
and
2 deletions
tetras_extraction/script/src/common.py
+
19
−
2
View file @
1c69742d
...
@@ -114,13 +114,30 @@ log_handler.setFormatter(
...
@@ -114,13 +114,30 @@ log_handler.setFormatter(
logging
.
Formatter
(
"
%(asctime)s - %(name)s - %(levelname)s - %(message)s
"
)
logging
.
Formatter
(
"
%(asctime)s - %(name)s - %(levelname)s - %(message)s
"
)
)
)
match
environ
.
get
(
"
LOGLEVEL
"
):
case
(
"
critical
"
|
"
CRITICAL
"
|
"
error
"
|
"
ERROR
"
|
"
warning
"
|
"
WARNING
"
|
"
info
"
|
"
INFO
"
|
"
debug
"
|
"
DEBUG
"
as
l
):
log_level
=
l
.
upper
()
case
_
:
log_level
=
logging
.
INFO
def
get_logger
(
name
:
str
)
->
logging
.
Logger
:
def
get_logger
(
name
:
str
)
->
logging
.
Logger
:
"""
Returns a configured `Logger`.
"""
Returns a configured `Logger`.
:param name: The name of the logger (it is recommended to use
`__
name
__`
)
:param name: The name of the logger (it is recommended to use
the file
name)
"""
"""
logger
=
logging
.
getLogger
(
name
)
logger
=
logging
.
getLogger
(
name
)
logger
.
setLevel
(
log
ging
.
INFO
)
logger
.
setLevel
(
log
_level
)
logger
.
addHandler
(
log_handler
)
logger
.
addHandler
(
log_handler
)
return
logger
return
logger
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