mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-07-03 07:16:12 +02:00
Added basic logging feature to understand how is configuration loaded
Conflicts: jrnl/cli.py jrnl/util.py
This commit is contained in:
parent
163dc04481
commit
640d426b71
2 changed files with 21 additions and 0 deletions
|
@ -11,6 +11,7 @@ from . import util
|
|||
from . import upgrade
|
||||
from . import __version__
|
||||
import yaml
|
||||
import logging
|
||||
|
||||
DEFAULT_CONFIG_NAME = 'jrnl.yaml'
|
||||
DEFAULT_JOURNAL_NAME = 'journal.txt'
|
||||
|
@ -25,6 +26,8 @@ CONFIG_FILE_PATH_FALLBACK = os.path.join(USER_HOME, ".jrnl_config")
|
|||
JOURNAL_PATH = xdg.BaseDirectory.save_data_path(XDG_RESOURCE) or USER_HOME
|
||||
JOURNAL_FILE_PATH = os.path.join(JOURNAL_PATH, DEFAULT_JOURNAL_NAME)
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def module_exists(module_name):
|
||||
"""Checks if a module exists and can be imported"""
|
||||
|
@ -76,11 +79,13 @@ def load_or_install_jrnl():
|
|||
"""
|
||||
config_path = CONFIG_FILE_PATH if os.path.exists(CONFIG_FILE_PATH) else CONFIG_FILE_PATH_FALLBACK
|
||||
if os.path.exists(config_path):
|
||||
log.debug('Reading configuration from file %s', config_path)
|
||||
config = util.load_config(CONFIG_FILE_PATH)
|
||||
upgrade.upgrade_jrnl_if_necessary(CONFIG_FILE_PATH)
|
||||
upgrade_config(config)
|
||||
return config
|
||||
else:
|
||||
log.debug('Configuration file not found, installing jrnl...')
|
||||
install()
|
||||
|
||||
def install():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue