mirror of
https://github.com/borgbackup/borg.git
synced 2026-04-25 16:19:21 -04:00
fuse2: optimize/generalize debug and test logging
This commit is contained in:
parent
2d1772f919
commit
f545ebbf0d
2 changed files with 8 additions and 6 deletions
|
|
@ -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():
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue