mirror of
https://github.com/vgough/encfs.git
synced 2025-02-09 06:19:50 +01:00
logging: enable debug log only in verbose mode
This commit is contained in:
parent
ad43aa10b2
commit
105a8acd60
@ -6,4 +6,17 @@ el::base::DispatchAction rlogAction = el::base::DispatchAction::NormalLog;
|
||||
|
||||
Error::Error(const char *msg) : runtime_error(msg) {}
|
||||
|
||||
void initLogging(bool enable_debug) {
|
||||
el::Loggers::addFlag(el::LoggingFlag::ColoredTerminalOutput);
|
||||
|
||||
el::Configurations defaultConf;
|
||||
defaultConf.setToDefault();
|
||||
defaultConf.set(el::Level::Verbose, el::ConfigurationType::Format,
|
||||
std::string("%datetime %level [%fbase:%line] %msg"));
|
||||
if (!enable_debug) {
|
||||
defaultConf.set(el::Level::Debug, el::ConfigurationType::Enabled, "false");
|
||||
}
|
||||
el::Loggers::reconfigureLogger("default", defaultConf);
|
||||
}
|
||||
|
||||
} // namespace encfs
|
||||
|
@ -23,14 +23,7 @@ class Error : public std::runtime_error {
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
inline void initLogging() {
|
||||
el::Configurations defaultConf;
|
||||
defaultConf.setToDefault();
|
||||
defaultConf.set(el::Level::Verbose, el::ConfigurationType::Format,
|
||||
std::string("%datetime %level [%fbase:%line] %msg"));
|
||||
el::Loggers::reconfigureLogger("default", defaultConf);
|
||||
el::Loggers::addFlag(el::LoggingFlag::ColoredTerminalOutput);
|
||||
}
|
||||
void initLogging(bool enable_debug = false);
|
||||
|
||||
// This can be changed to change log action between normal and syslog logging.
|
||||
// Not thread-safe, so any change must occur outside of threading context.
|
||||
|
@ -524,8 +524,6 @@ void *encfs_init(fuse_conn_info *conn) {
|
||||
void encfs_destroy(void *_ctx) {}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
encfs::initLogging();
|
||||
|
||||
#if defined(ENABLE_NLS) && defined(LOCALEDIR)
|
||||
setlocale(LC_ALL, "");
|
||||
bindtextdomain(PACKAGE, LOCALEDIR);
|
||||
@ -547,6 +545,8 @@ int main(int argc, char *argv[]) {
|
||||
el::Loggers::setVerboseLevel(1);
|
||||
}
|
||||
|
||||
encfs::initLogging(encfsArgs->isVerbose);
|
||||
|
||||
VLOG(1) << "Root directory: " << encfsArgs->opts->rootDir;
|
||||
VLOG(1) << "Fuse arguments: " << encfsArgs->toString();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user