Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/openvfsfuse/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ std::optional<openVFSfuse_Args> processArgs(int argc, char *argv[])
case 'd':
// enable debug logging, implies -f
out.fuseArgv.emplace_back("-d");
out.debugEnabled = true;
std::cout << "openVFSfuse running with debug log enabled" << std::endl;
break;
case 'i': {
Expand Down
7 changes: 7 additions & 0 deletions src/openvfsfuse/openvfsfuse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class VFSFuseContext
, _rootHandle(open(_mountPoint.c_str(), 0))
, _appsNoHydrateFull(args.appsNoHydrateFull)
, _appsNoHydrateEndsWith(args.appsNoHydrateEndsWith)
, _debugEnabled(args.debugEnabled)
{
assert(!_instance);

Expand Down Expand Up @@ -100,13 +101,16 @@ class VFSFuseContext
|| std::ranges::find_if(_appsNoHydrateEndsWith, [app](const auto &a) { return app.ends_with(a); }) != _appsNoHydrateEndsWith.cend();
}

bool debugEnabled() const { return _debugEnabled; }

private:
static VFSFuseContext *_instance;
std::filesystem::path _mountPoint;
std::string _owner;
int _rootHandle;
std::vector<std::string> _appsNoHydrateFull;
std::vector<std::string> _appsNoHydrateEndsWith;
bool _debugEnabled;
};

VFSFuseContext *VFSFuseContext::_instance = nullptr;
Expand Down Expand Up @@ -153,6 +157,9 @@ static int _transfer_id{12};

void openvfsfuse_log(const std::string &path, const char *action, int returncode, const char *format, ...)
{
if (!VFSFuseContext::instance().debugEnabled()) {
return;
}
// FIXME - whitelist of pathes that are not logged at all?
if (path == "./.OpenCloudSync.log")
return;
Expand Down
1 change: 1 addition & 0 deletions src/openvfsfuse/openvfsfuse.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ struct openVFSfuse_Args
std::vector<std::string> fuseArgv;
std::vector<std::string> appsNoHydrateFull; // these apps are not permitted to cause a dehydration
std::vector<std::string> appsNoHydrateEndsWith;
bool debugEnabled = false; // checked in the central logging function if logging is enabled
};

int initializeOpenVFSFuse(openVFSfuse_Args &openVFSArgs);
Expand Down