fuse2: optimize/generalize debug and test logging

This commit is contained in:
Thomas Waldmann 2025-11-24 17:45:52 +01:00
parent 2d1772f919
commit f545ebbf0d
No known key found for this signature in database
GPG key ID: 243ACFA951F78E01
2 changed files with 8 additions and 6 deletions

View file

@ -1,3 +1,4 @@
import datetime
import errno
import hashlib
import os
@ -27,14 +28,15 @@ from .platformflags import is_darwin
from .repository import Repository
from .remote import RemoteRepository
DEBUG_LOG = None # os.path.join(os.getcwd(), "fuse_debug.log")
def debug_log(msg):
"""Append debug message to fuse_debug.log"""
import datetime
timestamp = datetime.datetime.now().strftime("%H:%M:%S.%f")[:-3]
with open("/Users/tw/w/borg_ag/fuse_debug.log", "a") as f:
f.write(f"{timestamp} {msg}\n")
if DEBUG_LOG:
timestamp = datetime.datetime.now().strftime("%H:%M:%S.%f")[:-3]
with open(DEBUG_LOG, "a") as f:
f.write(f"{timestamp} {msg}\n")
def fuse_main():

View file

@ -119,7 +119,7 @@ def fuse_mount2(archiver, mountpoint, *args, **kwargs):
# For debugging, let's inherit stderr
# p = subprocess.Popen(full_cmd, env=env, stdout=subprocess.PIPE, stderr=None)
log_file_path = "/Users/tw/w/borg_ag/mount2.log"
log_file_path = os.path.join(os.getcwd(), "mount2.log")
log_file = open(log_file_path, "w")
p = subprocess.Popen(full_cmd, env=env, stdout=log_file, stderr=log_file)