Commit 2a6b9bc3 authored by Kirill Smelkov's avatar Kirill Smelkov

wcfs: Setup basic logging for warnings/errors to go to stderr when invoked as e.g. `wcfs serve`

If we do not setup logging explicitly, it will print only

    No handlers could be found for logger "wcfs"

instead of emitting useful details in before e.g.

    RuntimeError: fuse_unmount /dev/shm/wcfs/<X>: failed: fusermount: failed to unmount /dev/shm/wcfs/<X>: Device or resource busy
    (more details logged)

-> Fix it.
parent a7bf0311
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2018-2021 Nexedi SA and Contributors. # Copyright (C) 2018-2022 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com> # Kirill Smelkov <kirr@nexedi.com>
# #
# This program is free software: you can Use, Study, Modify and Redistribute # This program is free software: you can Use, Study, Modify and Redistribute
...@@ -737,6 +737,10 @@ def main(): ...@@ -737,6 +737,10 @@ def main():
zurl = argv[-1] # -a -b zurl -> zurl zurl = argv[-1] # -a -b zurl -> zurl
optv = argv[:-1] # -a -b zurl -> -a -b optv = argv[:-1] # -a -b zurl -> -a -b
# setup log.warn/error to go to stderr, so that details could be seen on
# e.g. "fuse_unmount: ... failed (more details logged)"
logging.basicConfig(stream=sys.stderr, level=logging.WARNING)
if cmd == "serve": if cmd == "serve":
if argv[0] == '-h': if argv[0] == '-h':
os.execv(_wcfs_exe(), [_wcfs_exe(), '-h']) os.execv(_wcfs_exe(), [_wcfs_exe(), '-h'])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment