FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
JWTConnect-Python-OidcMsg/src/oidcmsg/logging.py at develop · IdentityPython/JWTConnect-Python-OidcMsg · GitHub
This repository was archived by the owner on Jun 1, 2023. It is now read-only.
IdentityPython
JWTConnect-Python-OidcMsg
Repository navigation
Code
Issues
3
(3)
Pull requests
1
(1)
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
JWTConnect-Python-OidcMsg
/
src
/
oidcmsg
/
logging.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
52 lines (44 loc) · 1.28 KB
Breadcrumbs
JWTConnect-Python-OidcMsg
/
src
/
oidcmsg
/
logging.py
Copy path
File metadata and controls
52 lines (44 loc) · 1.28 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
"""Common logging functions"""
import
logging
import
os
from
logging
.
config
import
dictConfig
from
typing
import
Optional
import
yaml
LOGGING_CONF
=
'logging.yaml'
LOGGING_DEFAULT
=
{
'version'
:
1
,
'formatters'
: {
'default'
: {
'format'
:
'%(asctime)s %(name)s %(levelname)s %(message)s'
}
},
'handlers'
: {
'default'
: {
'class'
:
'logging.StreamHandler'
,
'formatter'
:
'default'
}
},
'root'
: {
'handlers'
: [
'default'
],
'level'
:
'INFO'
}
}
def
configure_logging
(
debug
:
Optional
[
bool
]
=
False
,
config
:
Optional
[
dict
]
=
None
,
filename
:
Optional
[
str
]
=
LOGGING_CONF
)
->
logging
.
Logger
:
"""Configure logging"""
if
config
is
not
None
:
config_dict
=
config
config_source
=
'dictionary'
elif
filename
is
not
None
and
os
.
path
.
exists
(
filename
):
with
open
(
filename
,
"rt"
)
as
file
:
config_dict
=
yaml
.
safe_load
(
file
)
config_source
=
'file'
else
:
config_dict
=
LOGGING_DEFAULT
config_source
=
'default'
if
debug
:
config_dict
[
'root'
][
'level'
]
=
'DEBUG'
dictConfig
(
config_dict
)
logging
.
debug
(
"Configured logging using %s"
,
config_source
)
return
logging
.
getLogger
()
Back
|
FazBrowse Home
|
New Git URL