summaryrefslogtreecommitdiff
path: root/src/pyssg/pyssg.py
diff options
context:
space:
mode:
authorDavid Luevano Alvarado <david@luevano.xyz>2022-04-17 20:58:13 -0600
committerDavid Luevano Alvarado <david@luevano.xyz>2022-04-17 20:58:13 -0600
commitdba12a02cc33b45fc9cc1395ee89f317ccf8da96 (patch)
tree5cfab03f37b3ba87820d1aa3ef20be422fde0a18 /src/pyssg/pyssg.py
parent6bec182703885761699f6d53bc9034933b03197e (diff)
add debug flag, minor fix in readme
Diffstat (limited to 'src/pyssg/pyssg.py')
-rw-r--r--src/pyssg/pyssg.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/pyssg/pyssg.py b/src/pyssg/pyssg.py
index 958b397..2844fbf 100644
--- a/src/pyssg/pyssg.py
+++ b/src/pyssg/pyssg.py
@@ -25,7 +25,17 @@ log: Logger = logging.getLogger(__name__)
def main() -> None:
args: dict[str, Union[str, bool]] = vars(get_parsed_arguments())
- if not len(sys.argv) > 1:
+ if args['debug']:
+ # need to modify the root logger specifically,
+ # as it is the one that holds the config
+ # (__name__ happens to resolve to pyssg in __init__)
+ root_logger: Logger = logging.getLogger('pyssg')
+ root_logger.setLevel(logging.DEBUG)
+ for handler in root_logger.handlers:
+ handler.setLevel(logging.DEBUG)
+ log.debug('changed logging level to DEBUG')
+
+ if not len(sys.argv) > 1 or (len(sys.argv) == 2 and args['debug']):
log.info('pyssg v%s - no arguments passed, --help for more', VERSION)
sys.exit(0)
@@ -77,7 +87,7 @@ def main() -> None:
# TODO: add logging to all of the build part, that includes the builder,
# database, discovery, page and parser
if args['build']:
- # start the db
+ log.debug('building the html files')
db: Database = Database(os.path.join(config.get('path', 'src'), '.files'))
db.read()