Private GIT
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SickRage-1
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
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vlbox
SickRage-1
Commits
e39c0a67
Commit
e39c0a67
authored
Sep 21, 2015
by
miigotu
Browse files
Options
Downloads
Plain Diff
Merge pull request #2556 from SiCKRAGETV/logger-lint
Fix linting errors in logger.py
parents
1393e6e6
c8a0df06
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
sickbeard/logger.py
+18
-14
18 additions, 14 deletions
sickbeard/logger.py
with
18 additions
and
14 deletions
sickbeard/logger.py
+
18
−
14
View file @
e39c0a67
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
#
#
# You should have received a copy of the GNU General Public License
# You should have received a copy of the GNU General Public License
# along with SickRage. If not, see <http://www.gnu.org/licenses/>.
# along with SickRage. If not, see <http://www.gnu.org/licenses/>.
# pylint: disable=W0703
from
__future__
import
with_statement
from
__future__
import
with_statement
import
os
import
os
...
@@ -65,6 +66,7 @@ class CensoredFormatter(logging.Formatter, object):
...
@@ -65,6 +66,7 @@ class CensoredFormatter(logging.Formatter, object):
def
format
(
self
,
record
):
def
format
(
self
,
record
):
"""
Strips censored items from string
"""
"""
Strips censored items from string
"""
msg
=
super
(
CensoredFormatter
,
self
).
format
(
record
)
msg
=
super
(
CensoredFormatter
,
self
).
format
(
record
)
# pylint: disable=W0612
for
k
,
v
in
censoredItems
.
iteritems
():
for
k
,
v
in
censoredItems
.
iteritems
():
if
v
and
len
(
v
)
>
0
and
v
in
msg
:
if
v
and
len
(
v
)
>
0
and
v
in
msg
:
msg
=
msg
.
replace
(
v
,
len
(
v
)
*
'
*
'
)
msg
=
msg
.
replace
(
v
,
len
(
v
)
*
'
*
'
)
...
@@ -131,8 +133,8 @@ class Logger(object):
...
@@ -131,8 +133,8 @@ class Logger(object):
for
logger
in
self
.
loggers
:
for
logger
in
self
.
loggers
:
logger
.
addHandler
(
rfh
)
logger
.
addHandler
(
rfh
)
def
shutdown
(
self
):
@staticmethod
def
shutdown
():
logging
.
shutdown
()
logging
.
shutdown
()
def
log
(
self
,
msg
,
level
=
INFO
,
*
args
,
**
kwargs
):
def
log
(
self
,
msg
,
level
=
INFO
,
*
args
,
**
kwargs
):
...
@@ -159,16 +161,17 @@ class Logger(object):
...
@@ -159,16 +161,17 @@ class Logger(object):
sys
.
exit
(
1
)
sys
.
exit
(
1
)
def
submit_errors
(
self
):
def
submit_errors
(
self
):
# pylint: disable=R0912,R0914,R0915
if
not
(
sickbeard
.
GIT_USERNAME
and
sickbeard
.
GIT_PASSWORD
and
sickbeard
.
DEBUG
and
len
(
classes
.
ErrorViewer
.
errors
)
>
0
):
if
not
(
sickbeard
.
GIT_USERNAME
and
sickbeard
.
GIT_PASSWORD
and
sickbeard
.
DEBUG
and
len
(
classes
.
ErrorViewer
.
errors
)
>
0
):
self
.
log
(
'
Please set your GitHub username and password in the config and enable debug. Unable to submit issue ticket to GitHub!
'
)
self
.
log
(
'
Please set your GitHub username and password in the config and enable debug. Unable to submit issue ticket to GitHub!
'
)
return
return
try
:
try
:
from
versionChecker
import
CheckVersion
from
sickbeard.
versionChecker
import
CheckVersion
checkversion
=
CheckVersion
()
checkversion
=
CheckVersion
()
needs_update
=
checkversion
.
check_for_new_version
()
checkversion
.
check_for_new_version
()
commits_behind
=
checkversion
.
updater
.
get_num_commits_behind
()
commits_behind
=
checkversion
.
updater
.
get_num_commits_behind
()
except
:
except
Exception
:
self
.
log
(
'
Could not check if your SickRage is updated, unable to submit issue ticket to GitHub!
'
)
self
.
log
(
'
Could not check if your SickRage is updated, unable to submit issue ticket to GitHub!
'
)
return
return
...
@@ -206,7 +209,7 @@ class Logger(object):
...
@@ -206,7 +209,7 @@ class Logger(object):
try
:
try
:
title_Error
=
str
(
curError
.
title
)
title_Error
=
str
(
curError
.
title
)
if
not
len
(
title_Error
)
or
title_Error
==
'
None
'
:
if
not
len
(
title_Error
)
or
title_Error
==
'
None
'
:
title_Error
=
re
.
match
(
"
^[A-Z0-9\-\[\] :]+::\s*(.*)$
"
,
ss
(
str
(
curError
.
message
))).
group
(
1
)
title_Error
=
re
.
match
(
r
"
^[A-Z0-9\-\[\] :]+::\s*(.*)$
"
,
ss
(
str
(
curError
.
message
))).
group
(
1
)
# if len(title_Error) > (1024 - len(u"[APP SUBMITTED]: ")):
# if len(title_Error) > (1024 - len(u"[APP SUBMITTED]: ")):
# 1000 just looks better than 1007 and adds some buffer
# 1000 just looks better than 1007 and adds some buffer
...
@@ -216,7 +219,7 @@ class Logger(object):
...
@@ -216,7 +219,7 @@ class Logger(object):
self
.
log
(
"
Unable to get error title :
"
+
ex
(
e
),
ERROR
)
self
.
log
(
"
Unable to get error title :
"
+
ex
(
e
),
ERROR
)
gist
=
None
gist
=
None
regex
=
"
^(%s)\s+([A-Z]+)\s+([0-9A-Z\-]+)\s*(.*)$
"
%
curError
.
time
regex
=
r
"
^(%s)\s+([A-Z]+)\s+([0-9A-Z\-]+)\s*(.*)$
"
%
curError
.
time
for
i
,
x
in
enumerate
(
log_data
):
for
i
,
x
in
enumerate
(
log_data
):
x
=
ss
(
x
)
x
=
ss
(
x
)
match
=
re
.
match
(
regex
,
x
)
match
=
re
.
match
(
regex
,
x
)
...
@@ -236,7 +239,7 @@ class Logger(object):
...
@@ -236,7 +239,7 @@ class Logger(object):
if
not
'
Windows
'
in
platform
.
platform
():
if
not
'
Windows
'
in
platform
.
platform
():
try
:
try
:
message
+=
u
"
Locale:
"
+
locale
.
getdefaultlocale
()[
1
]
+
"
\n
"
message
+=
u
"
Locale:
"
+
locale
.
getdefaultlocale
()[
1
]
+
"
\n
"
except
:
except
Exception
:
message
+=
u
"
Locale: unknown
"
+
"
\n
"
message
+=
u
"
Locale: unknown
"
+
"
\n
"
message
+=
u
"
Branch: **
"
+
sickbeard
.
BRANCH
+
"
**
\n
"
message
+=
u
"
Branch: **
"
+
sickbeard
.
BRANCH
+
"
**
\n
"
message
+=
u
"
Commit: SiCKRAGETV/SickRage@
"
+
sickbeard
.
CUR_COMMIT_HASH
+
"
\n
"
message
+=
u
"
Commit: SiCKRAGETV/SickRage@
"
+
sickbeard
.
CUR_COMMIT_HASH
+
"
\n
"
...
@@ -282,6 +285,7 @@ class Logger(object):
...
@@ -282,6 +285,7 @@ class Logger(object):
self
.
submitter_running
=
False
self
.
submitter_running
=
False
# pylint: disable=R0903
class
Wrapper
(
object
):
class
Wrapper
(
object
):
instance
=
Logger
()
instance
=
Logger
()
...
...
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