🎨 Improved logging code

- Silenced unwanted library messages
- Logging to file with a max size of 8MB

When the file size is passed, a backup of the file is created,
and the file gets truncated.
There can only be one current file and one backup file.
This commit is contained in:
GeoffreyCoulaud
2023-06-12 03:27:43 +02:00
parent 6a099b2bdd
commit 2798097623
2 changed files with 42 additions and 27 deletions

View File

@@ -16,9 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# SPDX-License-Identifier: GPL-3.0-or-later
import json
import logging
import sys
import gi
@@ -255,10 +253,7 @@ class CartridgesApplication(Adw.Application):
scope.add_action(simple_action)
def main(version): # pylint: disable=unused-argument
# Initiate logger
logging.basicConfig(level="DEBUG")
def main(_version):
setup_logging()
# Start app
app = CartridgesApplication()
return app.run(sys.argv)