Skip to content

Commit b3b4db8

Browse files
committed
Use logging file from JAMDICT_HOME
1 parent dec218e commit b3b4db8

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

jamdict/tools.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939

4040
import os
4141

42+
4243
from chirptext import confirm, TextReport, Timer
4344
from chirptext.cli import CLIApp, setup_logging
4445

@@ -54,7 +55,11 @@
5455
JMD_XML = config.get_file('JMDICT_XML')
5556
KD2_XML = config.get_file('KD2_XML')
5657
JMD_DB = config.get_file('JAMDICT_DB')
57-
setup_logging('logging.json', 'logs')
58+
59+
if os.path.isfile('logging.json'):
60+
setup_logging('logging.json', 'logs')
61+
else:
62+
setup_logging(os.path.join(config.home_dir(), 'logging.json'), 'logs')
5863

5964

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

0 commit comments

Comments
 (0)