Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ColossalAI
Commits
a951bc60
"examples/vscode:/vscode.git/clone" did not exist on "a7c35dcf9d8fdacfa544c0b002d60357dfc79625"
Unverified
Commit
a951bc60
authored
Jan 04, 2022
by
ver217
Committed by
GitHub
Jan 04, 2022
Browse files
update default logger (#100) (#101)
parent
96780e6e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
3 deletions
+17
-3
colossalai/context/config.py
colossalai/context/config.py
+3
-2
colossalai/logging/__init__.py
colossalai/logging/__init__.py
+14
-1
No files found.
colossalai/context/config.py
View file @
a951bc60
...
...
@@ -5,6 +5,7 @@ import inspect
import
sys
from
importlib.machinery
import
SourceFileLoader
from
pathlib
import
Path
from
colossalai.logging
import
get_dist_logger
class
Config
(
dict
):
...
...
@@ -88,8 +89,8 @@ class Config(dict):
else
:
config
.
_add_item
(
k
,
v
)
# TODO: replace with logger warning here when logger is done
print
(
'warning:
variables which starts with __, is a module or class declaration are omitted'
)
logger
=
get_dist_logger
()
logger
.
debug
(
'
variables which starts with __, is a module or class declaration are omitted
in config file
'
)
# remove module
del
sys
.
modules
[
module_name
]
...
...
colossalai/logging/__init__.py
View file @
a951bc60
from
typing
import
List
from
.logging
import
DistributedLogger
import
logging
__all__
=
[
'get_dist_logger'
,
'DistributedLogger'
]
def
get_dist_logger
(
name
=
'
root
'
):
def
get_dist_logger
(
name
=
'
colossalai
'
):
"""Get logger instance based on name. The DistributedLogger will create singleton instances,
which means that only one logger instance is created per name.
...
...
@@ -14,3 +16,14 @@ def get_dist_logger(name='root'):
:rtype: :class:`colossalai.logging.DistributedLogger`
"""
return
DistributedLogger
.
get_instance
(
name
=
name
)
def
disable_existing_loggers
(
except_loggers
:
List
[
str
]
=
[
'colossalai'
]):
"""Set the level of existing loggers to `WARNING`.
:param except_loggers: loggers in this `list` will be ignored when disabling, defaults to ['colossalai']
:type except_loggers: list, optional
"""
for
log_name
in
logging
.
Logger
.
manager
.
loggerDict
.
keys
():
if
log_name
not
in
except_loggers
:
logging
.
getLogger
(
log_name
).
setLevel
(
logging
.
WARNING
)
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