mirror of
https://github.com/KevinMidboe/spotify-downloader.git
synced 2025-10-29 18:00:15 +00:00
Setup logzero.logger
This commit is contained in:
14
CHANGES.md
14
CHANGES.md
@@ -6,9 +6,21 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [2.0.0] - <add-date-here>
|
||||||
|
### Migrating from v1.2.6 to v2.0.0
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
- Command-line options
|
||||||
|
|
||||||
## [1.2.6] (Hotfix Release) - 2020-03-02
|
## [1.2.6] (Hotfix Release) - 2020-03-02
|
||||||
### Fixed
|
### Fixed
|
||||||
Embed release date metadata only when available (follow up of #672) ([@ritiek](https://github.com/ritiek)) (#674)
|
- Embed release date metadata only when available (follow up of #672) ([@ritiek](https://github.com/ritiek)) (#674)
|
||||||
|
|
||||||
## [1.2.5] - 2020-03-02
|
## [1.2.5] - 2020-03-02
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
from spotdl.authorize.services import AuthorizeSpotify
|
from spotdl.authorize.services import AuthorizeSpotify
|
||||||
from spotdl import command_line
|
from spotdl import command_line
|
||||||
|
|
||||||
|
import logzero
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
def match_arguments(arguments):
|
def match_arguments(arguments):
|
||||||
@@ -47,8 +48,18 @@ def match_arguments(arguments):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def set_logger(level):
|
||||||
|
fmt = "%(color)s%(levelname)s:%(end_color)s %(message)s"
|
||||||
|
formatter = logzero.LogFormatter(fmt=fmt)
|
||||||
|
logzero.formatter(formatter)
|
||||||
|
logzero.loglevel(level)
|
||||||
|
return logzero.logger
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
arguments = command_line.get_arguments()
|
arguments = command_line.get_arguments()
|
||||||
|
logger = set_logger(arguments.log_level)
|
||||||
|
logger.debug(arguments.__dict__)
|
||||||
|
|
||||||
AuthorizeSpotify(
|
AuthorizeSpotify(
|
||||||
client_id=arguments.spotify_client_id,
|
client_id=arguments.spotify_client_id,
|
||||||
@@ -56,12 +67,10 @@ def main():
|
|||||||
)
|
)
|
||||||
# youtube_tools.set_api_key()
|
# youtube_tools.set_api_key()
|
||||||
|
|
||||||
# logzero.setup_default_logger(formatter=const._formatter, level=const.args.log_level)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
match_arguments(arguments.__dict__)
|
match_arguments(arguments.__dict__)
|
||||||
except KeyboardInterrupt as e:
|
except KeyboardInterrupt as e:
|
||||||
# log.exception(e)
|
logger.exception(e)
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ from spotdl.track import Track
|
|||||||
|
|
||||||
import spotdl.util
|
import spotdl.util
|
||||||
|
|
||||||
|
from logzero import logger
|
||||||
import os
|
import os
|
||||||
import urllib.request
|
import urllib.request
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user