Skip to content
This repository has been archived by the owner on Nov 19, 2019. It is now read-only.

Commit

Permalink
Set stderr loghandler in isbg_run
Browse files Browse the repository at this point in the history
Setting the log handler that logs everything to stderr only in the
`isbg_run` method meant for when isbg is run as command / top level
script.

When isbg is run as a library, the caller is responsible for setting up
log output. If we add a log handler this can lead to messages being
duplicated.
  • Loading branch information
duk3luk3 committed Jan 19, 2017
1 parent 358a219 commit b2e537a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions isbg/isbg.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,12 +701,6 @@ def spamlearn(self):
return result

def do_isbg(self):
ch = logging.StreamHandler()
self.logger.addHandler(ch)
if self.verbose:
ch.setLevel(logging.DEBUG)
else:
ch.setLevel(logging.INFO)

if self.spamc:
self.satest = ["spamc", "-c"]
Expand Down Expand Up @@ -850,6 +844,12 @@ def do_isbg(self):
def isbg_run():
isbg = ISBG()
isbg.parse_args()
ch = logging.StreamHandler()
isbg.logger.addHandler(ch)
if self.verbose:
ch.setLevel(logging.DEBUG)
else:
ch.setLevel(logging.INFO)
isbg.do_isbg()

if __name__ == '__main__':
Expand Down

0 comments on commit b2e537a

Please sign in to comment.