Add more logging and configurable levels
This commit is contained in:
+11
-4
@@ -71,9 +71,14 @@ class StandardNotesFUSE(LoggingMixIn, Operations):
|
||||
path_parts = path.split('/')
|
||||
note_name = path_parts[1]
|
||||
note = self.notes[note_name]
|
||||
text = note['text'][:offset] + data.decode()
|
||||
uuid = note['uuid']
|
||||
|
||||
try:
|
||||
text = note['text'][:offset] + data.decode()
|
||||
except UnicodeError:
|
||||
logging.error('Unable to parse non-unicode data.')
|
||||
raise FuseOSError(errno.EIO)
|
||||
|
||||
self.item_manager.writeNote(uuid, text)
|
||||
|
||||
return len(data)
|
||||
@@ -84,6 +89,7 @@ class StandardNotesFUSE(LoggingMixIn, Operations):
|
||||
|
||||
# disallow hidden files (usually editor / OS files)
|
||||
if note_name[0] == '.':
|
||||
logging.error('Creation of hidden files is disabled.')
|
||||
raise FuseOSError(errno.EPERM)
|
||||
|
||||
now = datetime.utcnow().isoformat()[:-3] + 'Z' # hack
|
||||
@@ -103,6 +109,10 @@ class StandardNotesFUSE(LoggingMixIn, Operations):
|
||||
|
||||
return 0
|
||||
|
||||
def mkdir(self, path, mode):
|
||||
logging.error('Creation of directories is disabled.')
|
||||
raise FuseOSError(errno.EPERM)
|
||||
|
||||
def chmod(self, path, mode):
|
||||
return 0
|
||||
|
||||
@@ -112,9 +122,6 @@ class StandardNotesFUSE(LoggingMixIn, Operations):
|
||||
def destroy(self, path):
|
||||
return 0
|
||||
|
||||
def mkdir(self, path, mode):
|
||||
return 0
|
||||
|
||||
def readlink(self, path):
|
||||
return 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user