Remove too many debug messages

This commit is contained in:
2024-12-19 22:00:42 +01:00
parent 0aa67f5cc2
commit b065938211
26 changed files with 75 additions and 586 deletions

View File

@@ -30,21 +30,12 @@ type FileNode struct {
// ListFilesRecursively returns a list of all files in the workspace directory and its subdirectories.
// Workspace is identified by the given userID and workspaceID.
func (s *Service) ListFilesRecursively(userID, workspaceID int) ([]FileNode, error) {
log := getLogger()
log.Debug("listing files recursively",
"userID", userID,
"workspaceID", workspaceID)
workspacePath := s.GetWorkspacePath(userID, workspaceID)
nodes, err := s.walkDirectory(workspacePath, "")
if err != nil {
return nil, err
}
log.Debug("file listing complete",
"userID", userID,
"workspaceID", workspaceID,
"nodeCount", len(nodes))
return nodes, nil
}
@@ -116,12 +107,6 @@ func (s *Service) walkDirectory(dir, prefix string) ([]FileNode, error) {
// Files are searched recursively in the workspace directory and its subdirectories.
// Workspace is identified by the given userID and workspaceID.
func (s *Service) FindFileByName(userID, workspaceID int, filename string) ([]string, error) {
log := getLogger()
log.Debug("searching for file by name",
"userID", userID,
"workspaceID", workspaceID,
"filename", filename)
var foundPaths []string
workspacePath := s.GetWorkspacePath(userID, workspaceID)
@@ -149,23 +134,12 @@ func (s *Service) FindFileByName(userID, workspaceID int, filename string) ([]st
return nil, fmt.Errorf("file not found")
}
log.Debug("file search complete",
"userID", userID,
"workspaceID", workspaceID,
"filename", filename,
"matchCount", len(foundPaths))
return foundPaths, nil
}
// GetFileContent returns the content of the file at the given filePath.
// Path must be a relative path within the workspace directory given by userID and workspaceID.
func (s *Service) GetFileContent(userID, workspaceID int, filePath string) ([]byte, error) {
log := getLogger()
log.Debug("reading file content",
"userID", userID,
"workspaceID", workspaceID,
"path", filePath)
fullPath, err := s.ValidatePath(userID, workspaceID, filePath)
if err != nil {
return nil, err
@@ -177,11 +151,6 @@ func (s *Service) GetFileContent(userID, workspaceID int, filePath string) ([]by
// Path must be a relative path within the workspace directory given by userID and workspaceID.
func (s *Service) SaveFile(userID, workspaceID int, filePath string, content []byte) error {
log := getLogger()
log.Debug("saving file",
"userID", userID,
"workspaceID", workspaceID,
"path", filePath,
"contentSize", len(content))
fullPath, err := s.ValidatePath(userID, workspaceID, filePath)
if err != nil {
@@ -209,11 +178,6 @@ func (s *Service) SaveFile(userID, workspaceID int, filePath string, content []b
// Path must be a relative path within the workspace directory given by userID and workspaceID.
func (s *Service) DeleteFile(userID, workspaceID int, filePath string) error {
log := getLogger()
log.Debug("deleting file",
"userID", userID,
"workspaceID", workspaceID,
"path", filePath)
fullPath, err := s.ValidatePath(userID, workspaceID, filePath)
if err != nil {
return err
@@ -239,11 +203,6 @@ type FileCountStats struct {
// GetFileStats returns the total number of files and related statistics in a workspace
// Workspace is identified by the given userID and workspaceID
func (s *Service) GetFileStats(userID, workspaceID int) (*FileCountStats, error) {
log := getLogger()
log.Debug("gathering file statistics",
"userID", userID,
"workspaceID", workspaceID)
workspacePath := s.GetWorkspacePath(userID, workspaceID)
// Check if workspace exists
@@ -256,27 +215,16 @@ func (s *Service) GetFileStats(userID, workspaceID int) (*FileCountStats, error)
return nil, err
}
log.Debug("file statistics collected",
"userID", userID,
"workspaceID", workspaceID,
"totalFiles", stats.TotalFiles,
"totalSize", stats.TotalSize)
return stats, nil
}
// GetTotalFileStats returns the total file statistics for the storage.
func (s *Service) GetTotalFileStats() (*FileCountStats, error) {
log := getLogger()
log.Debug("gathering total storage statistics")
stats, err := s.countFilesInPath(s.RootDir)
if err != nil {
return nil, err
}
log.Debug("total storage statistics collected",
"totalFiles", stats.TotalFiles,
"totalSize", stats.TotalSize)
return stats, nil
}