Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
logger-36
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
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DEBREUVE Eric
logger-36
Commits
144aeb39
Commit
144aeb39
authored
7 months ago
by
DEBREUVE Eric
Browse files
Options
Downloads
Patches
Plain Diff
added exit_on_critical
parent
709083ac
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
package/logger_36/type/logger.py
+12
-6
12 additions, 6 deletions
package/logger_36/type/logger.py
package/logger_36/version.py
+1
-1
1 addition, 1 deletion
package/logger_36/version.py
test/main.py
+2
-0
2 additions, 0 deletions
test/main.py
with
15 additions
and
7 deletions
package/logger_36/type/logger.py
+
12
−
6
View file @
144aeb39
...
...
@@ -40,9 +40,10 @@ from logger_36.type.issue import NewIssue, issue_t
@d.dataclass
(
slots
=
True
,
repr
=
False
,
eq
=
False
)
class
logger_t
(
lggg
.
Logger
):
name_
:
d
.
InitVar
[
str
]
=
LOGGER_NAME
level
:
d
.
InitVar
[
int
]
=
lggg
.
NOTSET
level
_
:
d
.
InitVar
[
int
]
=
lggg
.
NOTSET
activate_wrn_interceptions
:
d
.
InitVar
[
bool
]
=
True
exit_on_error
:
bool
=
False
exit_on_error
:
bool
=
False
# Implies exit_on_critical.
exit_on_critical
:
bool
=
False
# Must not be False until at least one handler has been added.
should_hold_messages
:
bool
=
True
...
...
@@ -58,15 +59,17 @@ class logger_t(lggg.Logger):
)
def
__post_init__
(
self
,
name_
:
str
,
level
:
int
,
activate_wrn_interceptions
:
bool
self
,
name_
:
str
,
level
_
:
int
,
activate_wrn_interceptions
:
bool
)
->
None
:
""""""
lggg
.
Logger
.
__init__
(
self
,
name_
)
self
.
setLevel
(
level
)
self
.
propagate
=
False
self
.
setLevel
(
level
_
)
self
.
propagate
=
False
# Part of lggg.Logger.
if
activate_wrn_interceptions
:
self
.
_ActivateWarningInterceptions
()
if
self
.
exit_on_error
:
self
.
exit_on_critical
=
True
def
_ActivateWarningInterceptions
(
self
)
->
None
:
"""
...
...
@@ -211,7 +214,10 @@ class logger_t(lggg.Logger):
else
:
lggg
.
Logger
.
handle
(
self
,
record
)
if
self
.
exit_on_error
and
(
record
.
levelno
in
(
lggg
.
ERROR
,
lggg
.
CRITICAL
)):
if
(
self
.
exit_on_critical
and
(
record
.
levelno
is
lggg
.
CRITICAL
))
or
(
self
.
exit_on_error
and
(
record
.
levelno
is
lggg
.
ERROR
)):
# Also works if self.exit_on_error and record.levelno is lggg.CRITICAL since
# __post_init__ set self.exit_on_critical if self.exit_on_error.
sstm
.
exit
(
1
)
def
AddContextLevel
(
self
,
new_level
:
str
,
/
)
->
None
:
...
...
This diff is collapsed.
Click to expand it.
package/logger_36/version.py
+
1
−
1
View file @
144aeb39
...
...
@@ -4,7 +4,7 @@ Contributor(s): Eric Debreuve (eric.debreuve@cnrs.fr) since 2023
SEE COPYRIGHT NOTICE BELOW
"""
__version__
=
"
2024.1
8
"
__version__
=
"
2024.1
9
"
"""
COPYRIGHT NOTICE
...
...
This diff is collapsed.
Click to expand it.
test/main.py
+
2
−
0
View file @
144aeb39
...
...
@@ -122,6 +122,8 @@ sstm.stdout.writelines(
)
)
print
(
"
\n
--- DONE
"
)
"""
COPYRIGHT NOTICE
...
...
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