From c1bd98c444cfb1a970c961db789c20bd9a0adc21 Mon Sep 17 00:00:00 2001 From: Sven Sager Date: Tue, 3 Oct 2023 09:37:33 +0200 Subject: [PATCH] feat: Add dummy main application script The script uses the logger system and prints an string. You can try the programm call with and without `-vv`so see the differences of logging levels. --- src/revpi_middleware/main_application.py | 30 ++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/revpi_middleware/main_application.py diff --git a/src/revpi_middleware/main_application.py b/src/revpi_middleware/main_application.py new file mode 100644 index 0000000..ea0cd99 --- /dev/null +++ b/src/revpi_middleware/main_application.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# SPDX-FileCopyrightText: 2025 KUNBUS GmbH +# SPDX-License-Identifier: GPL-2.0-or-later +"""Main application of revpi-middleware daemon.""" +from logging import getLogger + +from . import proginit as pi + +log = getLogger(__name__) + + +def main() -> int: + """ + This is the main entry point. + + We do not pack this to a 'if __name__ == "__main__"' thing to be able to + call this function from different places. The __main__ module and entry + points in the setup.py will call this function and linke to have an int + as return value for the exit code. + """ + log.debug("Enter main() function") + + log.warning(f"This is the empty '{pi.programname}' application so far") + + log.debug("Leave main() function") + + # Finally, call the cleanup function of proginit to flush all log buffers. + pi.cleanup() + + return 0