Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
seminar-breakout
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shashank Suhas
seminar-breakout
Commits
a98f005a
Commit
a98f005a
authored
Feb 16, 2016
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fix in Py3 compatiblity
parent
02e94b63
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
+10
-3
tensorpack/utils/logger.py
tensorpack/utils/logger.py
+10
-3
No files found.
tensorpack/utils/logger.py
View file @
a98f005a
...
...
@@ -7,6 +7,10 @@ import logging
import
os
,
shutil
import
os.path
from
termcolor
import
colored
import
sys
if
not
sys
.
version_info
>=
(
3
,
0
):
input
=
raw_input
# for compatibility
from
.utils
import
mkdir_p
__all__
=
[]
...
...
@@ -21,8 +25,12 @@ class MyFormatter(logging.Formatter):
fmt
=
date
+
' '
+
colored
(
'ERR'
,
'red'
,
attrs
=
[
'blink'
,
'underline'
])
+
' '
+
msg
else
:
fmt
=
date
+
' '
+
msg
# TODO this doesn't work in Python3
self
.
_fmt
=
fmt
if
hasattr
(
self
,
'_style'
):
# Python3 compatibilty
self
.
_style
.
_fmt
=
fmt
self
.
_fmt
=
fmt
else
:
self
.
_fmt
=
fmt
return
super
(
MyFormatter
,
self
)
.
format
(
record
)
def
getlogger
():
...
...
@@ -32,7 +40,6 @@ def getlogger():
handler
=
logging
.
StreamHandler
()
handler
.
setFormatter
(
MyFormatter
(
datefmt
=
'
%
d
%
H:
%
M:
%
S'
))
logger
.
addHandler
(
handler
)
logger
.
warn
(
"hahah"
)
return
logger
logger
=
getlogger
()
...
...
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