pull/30/head
deadc0de6 1 year ago
parent a69a751544
commit c318a62941

@ -112,8 +112,6 @@ def cmd_index(args: Dict[str, Any],
Logger.err('aborted')
return
node = noder.get_storage_node(top, name)
Logger.debug(f'top node: {top}')
Logger.debug(f'storage node: {node}')
node.parent = None
start = datetime.datetime.now()

@ -6,7 +6,6 @@ fuse for catcli
"""
import os
import logging
from time import time
from stat import S_IFDIR, S_IFREG
from typing import List, Dict, Any, Optional
@ -19,14 +18,6 @@ from catcli.utils import path_to_search_all, path_to_top
from catcli import nodes
# build custom logger to log in /tmp
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
fh = logging.FileHandler('/tmp/fuse-catcli.log')
fh.setLevel(logging.DEBUG)
logger.addHandler(fh)
class Fuser:
"""fuse filesystem mounter"""
@ -114,8 +105,6 @@ class CatcliFilesystem(fuse.LoggingMixIn, fuse.Operations): # type: ignore
def getattr(self, path: str, _fh: Any = None) -> Dict[str, Any]:
"""return attr of file pointed by path"""
logger.info('getattr path: %s', path)
if path == '/':
# mountpoint
curt = time()
@ -135,7 +124,6 @@ class CatcliFilesystem(fuse.LoggingMixIn, fuse.Operations): # type: ignore
def readdir(self, path: str, _fh: Any) -> List[str]:
"""read directory content"""
logger.info('readdir path: %s', path)
content = ['.', '..']
entries = self._get_entries(path)
for entry in entries:

@ -69,16 +69,3 @@ class Logger:
"""make it bold"""
string = fix_badchars(string)
return f'{Colors.BOLD}{string}{Colors.RESET}'
@classmethod
def log_to_file(cls: Type[CLASSTYPE],
path: str,
string: str,
append: bool = True) -> None:
"""log to file"""
string = fix_badchars(string)
mode = 'w'
if append:
mode = 'a'
with open(path, mode, encoding='UTF-8') as file:
file.write(string)

@ -118,7 +118,6 @@ class Walker:
if node:
node.flag()
continue
self._log2file(f'update catalog for \"{sub}\"')
node = self.noder.new_file_node(os.path.basename(file), sub,
parent, storagepath)
if node:
@ -131,7 +130,6 @@ class Walker:
treepath = os.path.join(storagepath, adir)
reindex, dummy = self._need_reindex(parent, sub, treepath)
if reindex:
self._log2file(f'update catalog for \"{sub}\"')
dummy = self.noder.new_dir_node(base, sub,
parent, storagepath)
cnt += 1
@ -189,10 +187,3 @@ class Walker:
if len(string) > self.MAXLINELEN:
string = string[:self.MAXLINELEN] + '...'
Logger.progr(f'indexing: {string:80}')
def _log2file(self, string: str) -> None:
"""log to file"""
if not self.lpath:
return
line = f'{string}\n'
Logger.log_to_file(self.lpath, line, append=True)

Loading…
Cancel
Save