Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
panacota
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
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
Amandine PERRIN
panacota
Commits
e22c7cb9
Commit
e22c7cb9
authored
6 years ago
by
Amandine PERRIN
Browse files
Options
Downloads
Patches
Plain Diff
Add an option to force creation of details file in logger
parent
07c6c7e6
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
PanACoTA/subcommands/annotate.py
+1
-1
1 addition, 1 deletion
PanACoTA/subcommands/annotate.py
PanACoTA/utils.py
+7
-4
7 additions, 4 deletions
PanACoTA/utils.py
with
8 additions
and
5 deletions
PanACoTA/subcommands/annotate.py
+
1
−
1
View file @
e22c7cb9
...
...
@@ -253,7 +253,7 @@ def main(list_file, db_path, res_dir, name, date, l90=100, nbcont=999, cutn=5,
if
verbose
>=
15
:
level
=
logging
.
DEBUG
logfile_base
=
os
.
path
.
join
(
res_dir
,
"
PanACoTA-annotate_
"
+
listfile_base
)
utils
.
init_logger
(
logfile_base
,
level
,
name
=
''
,
verbose
=
verbose
,
quiet
=
quiet
)
utils
.
init_logger
(
logfile_base
,
level
,
name
=
''
,
details
=
True
,
verbose
=
verbose
,
quiet
=
quiet
)
logger
=
logging
.
getLogger
(
''
)
logger
.
info
(
"
Let
'
s start!
"
)
...
...
This diff is collapsed.
Click to expand it.
PanACoTA/utils.py
+
7
−
4
View file @
e22c7cb9
...
...
@@ -29,7 +29,7 @@ except:
import
pickle
def
init_logger
(
logfile_base
,
level
,
name
,
verbose
=
0
,
quiet
=
False
):
def
init_logger
(
logfile_base
,
level
,
name
,
details
=
False
,
verbose
=
0
,
quiet
=
False
):
"""
Create logger and its handlers, and set them to the given level
...
...
@@ -125,9 +125,12 @@ def init_logger(logfile_base, level, name, verbose=0, quiet=False):
logger
.
addHandler
(
errfile_handler
)
# add handler to logger
# Create handler 3: detailsfile. Write everything to this file, except debug
# Create it only if level is less than INFO. otherwise, it is the
# same file as .log
if
level
<
logging
.
INFO
or
quiet
:
# Create it only if:
# - level is <= info (for modules which have no details, so detailsfile is the same as
# logfile)
# - details==True force creation of detailsfile
# - quiet==True nothing in stdout, put all log files so that user can check
if
level
<
logging
.
INFO
or
quiet
or
details
:
detfile_handler
=
RotatingFileHandler
(
detailfile
,
'
w
'
,
10000000
,
5
)
detfile_handler
.
setLevel
(
logging
.
DETAIL
)
detfile_handler
.
setFormatter
(
formatter_file
)
# add formatter
...
...
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