Skip to content

Commit

Permalink
Use logging file from JAMDICT_HOME
Browse files Browse the repository at this point in the history
  • Loading branch information
letuananh committed Jul 19, 2018
1 parent dec218e commit b3b4db8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions jamdict/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

import os


from chirptext import confirm, TextReport, Timer
from chirptext.cli import CLIApp, setup_logging

Expand All @@ -54,7 +55,11 @@
JMD_XML = config.get_file('JMDICT_XML')
KD2_XML = config.get_file('KD2_XML')
JMD_DB = config.get_file('JAMDICT_DB')
setup_logging('logging.json', 'logs')

if os.path.isfile('logging.json'):
setup_logging('logging.json', 'logs')
else:
setup_logging(os.path.join(config.home_dir(), 'logging.json'), 'logs')


# -------------------------------------------------------------------------------
Expand Down Expand Up @@ -152,7 +157,7 @@ def file_status(file_path):
def show_info(cli, args):
''' Show jamdict configuration (data folder, configuration file location, etc.) '''
output = TextReport(args.output) if 'output' in args else TextReport()
output.header("Jamdict | {} - Version: {}".format(version_info.__description__, version_info.__version_long__), level='h0')
output.header("Jamdict | {} - Version: {}".format(version_info.__description__, version_info.__version__), level='h0')
output.header("Basic configuration")
output.print("JAMDICT_HOME: {}".format(config.home_dir()))
output.print("Configuration location: {}".format(config._get_config_manager().locate_config()))
Expand Down

0 comments on commit b3b4db8

Please sign in to comment.