-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[added] The new --verbose command line argument turns on more logging.
- Loading branch information
Showing
6 changed files
with
82 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
/.idea/ | ||
/kobo-book-downloader/__pycache__/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
from logging import Logger | ||
from typing import TYPE_CHECKING | ||
|
||
if TYPE_CHECKING: | ||
from Kobo import Kobo | ||
from Settings import Settings | ||
|
||
class Globals: | ||
Kobo = None | ||
Settings = None | ||
Logger = None # type: Logger | None | ||
Kobo = None # type: Kobo | None | ||
Settings = None # type: Settings | None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import colorama | ||
|
||
import logging | ||
|
||
class LogFormatter( logging.Formatter ): | ||
def __init__( self ): | ||
self.DebugFormatter = logging.Formatter( colorama.Style.BRIGHT + colorama.Fore.GREEN + "%(levelname)s: " + colorama.Style.RESET_ALL + "%(message)s" ) | ||
self.ErrorFormatter = logging.Formatter( colorama.Style.BRIGHT + colorama.Fore.RED + "%(levelname)s: " + colorama.Style.RESET_ALL + "%(message)s" ) | ||
|
||
def format( self, record ): | ||
if record.levelname == "DEBUG": | ||
return self.DebugFormatter.format( record ) | ||
elif record.levelname == "ERROR": | ||
return self.ErrorFormatter.format( record ) | ||
else: | ||
return super().format( record ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters