Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
cloudooo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
cloudooo
Commits
45cacfac
Commit
45cacfac
authored
Oct 25, 2023
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
supports logging to a file
parent
7e4f8643
Pipeline
#32354
passed with stage
in 0 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
4 deletions
+10
-4
cloudooo/paster_application.py
cloudooo/paster_application.py
+5
-2
cloudooo/util.py
cloudooo/util.py
+5
-2
No files found.
cloudooo/paster_application.py
View file @
45cacfac
...
@@ -65,9 +65,12 @@ def application(global_config, **local_config):
...
@@ -65,9 +65,12 @@ def application(global_config, **local_config):
local_config
[
"env"
]
=
environment_dict
local_config
[
"env"
]
=
environment_dict
gc
.
enable
()
gc
.
enable
()
util
.
configureLogger
(
debug_mode
=
util
.
convertStringToBool
(
util
.
configureLogger
(
debug_mode
=
util
.
convertStringToBool
(
# .lower() is for backward compatibility
# .lower() is for backward compatibility
local_config
.
get
(
'debug_mode'
,
'false'
).
lower
()))
local_config
.
get
(
'debug_mode'
,
'false'
).
lower
()),
logfile
=
local_config
.
get
(
'logfile'
)
)
# path of directory to run cloudooo
# path of directory to run cloudooo
working_path
=
local_config
.
get
(
'working_path'
)
working_path
=
local_config
.
get
(
'working_path'
)
if
not
path
.
exists
(
working_path
):
if
not
path
.
exists
(
working_path
):
...
...
cloudooo/util.py
View file @
45cacfac
...
@@ -60,7 +60,7 @@ def loadMimetypeList():
...
@@ -60,7 +60,7 @@ def loadMimetypeList():
mimetypes
.
init
(
files
=
[
mime_types_url
,
])
mimetypes
.
init
(
files
=
[
mime_types_url
,
])
def
configureLogger
(
level
=
None
,
debug_mode
=
False
):
def
configureLogger
(
level
=
None
,
debug_mode
=
False
,
logfile
=
None
):
"""Configure logger.
"""Configure logger.
Keyword arguments:
Keyword arguments:
level -- Level to prints the log messages
level -- Level to prints the log messages
...
@@ -82,7 +82,10 @@ def configureLogger(level=None, debug_mode=False):
...
@@ -82,7 +82,10 @@ def configureLogger(level=None, debug_mode=False):
logger
.
propagate
=
0
logger
.
propagate
=
0
logger
.
setLevel
(
level
)
logger
.
setLevel
(
level
)
# create console handler and set level to debug
# create console handler and set level to debug
ch
=
logging
.
StreamHandler
()
if
logfile
:
ch
=
logging
.
FileHandler
(
logfile
)
else
:
ch
=
logging
.
StreamHandler
()
ch
.
setLevel
(
level
)
ch
.
setLevel
(
level
)
# create formatter
# create formatter
format
=
"%(asctime).19s - %(name)s - %(levelname)s - %(message)s"
format
=
"%(asctime).19s - %(name)s - %(levelname)s - %(message)s"
...
...
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