From: František Dvořák Date: Thu, 17 Oct 2013 17:48:01 +0000 (+0200) Subject: Replace all syslog() calls by internal macro. X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=262bad607258d12f9d90ad1aa37945630623803d;p=dmlite-plugins-vfs.git Replace all syslog() calls by internal macro. --- diff --git a/src/Vfs.cpp b/src/Vfs.cpp index 74d6dc6..65f8ea9 100644 --- a/src/Vfs.cpp +++ b/src/Vfs.cpp @@ -90,7 +90,7 @@ void VfsFactory::configure(const std::string& key, const std::string& value) thr Catalog* VfsFactory::createCatalog(PluginManager*) throw (DmException) { - syslog(LOG_DEBUG, "%s", __func__); + debug(""); return new VfsCatalog(this->hostName_, this->nsPrefix_, this->allow_, this->deny_, this->allowWrite_, this->denyWrite_); } @@ -98,7 +98,7 @@ Catalog* VfsFactory::createCatalog(PluginManager*) throw (DmException) PoolManager* VfsFactory::createPoolManager(PluginManager*) throw (DmException) { - syslog(LOG_DEBUG, "%s", __func__); + debug(""); return new VfsPoolManager(this->hostName_, this->tokenPasswd_, this->tokenUseIp_, this->tokenLife_); @@ -115,7 +115,7 @@ std::string VfsFactory::implementedPool() throw () PoolDriver* VfsFactory::createPoolDriver() throw (DmException) { - syslog(LOG_DEBUG, "%s", __func__); + debug(""); return new VfsPoolDriver(this->hostName_, this->nsPrefix_, this->tokenPasswd_, this->tokenUseIp_, this->tokenLife_); @@ -125,7 +125,7 @@ PoolDriver* VfsFactory::createPoolDriver() throw (DmException) IODriver* VfsFactory::createIODriver(PluginManager*) throw (DmException) { - syslog(LOG_DEBUG, "%s", __func__); + debug(""); return new VfsIODriver(this->diskPrefix_, this->tokenPasswd_, this->tokenUseIp_); } @@ -133,7 +133,7 @@ IODriver* VfsFactory::createIODriver(PluginManager*) throw (DmException) Authn* VfsFactory::createAuthn(PluginManager*) throw (DmException) { - syslog(LOG_DEBUG, "%s", __func__); + debug(""); return new VfsAuthn(); } diff --git a/src/VfsIO.cpp b/src/VfsIO.cpp index 60fdf4d..ad76f2b 100644 --- a/src/VfsIO.cpp +++ b/src/VfsIO.cpp @@ -113,13 +113,13 @@ VfsIOHandler::VfsIOHandler(const std::string& urlpath, const std::string& prefix else curdir = curdir + "/" + components[i]; // ignore all errors - just go from "/" toward deeper levels if (mkdir(curdir.c_str(), 0755) == 0) - syslog(LOG_DEBUG, "%s: created directory '%s'", __func__, curdir.c_str()); + debug("created directory '%s'", curdir.c_str()); } } lpath = getLocalPath(path); this->fd_ = ::open(lpath.c_str(), flags, mode); - syslog(LOG_DEBUG, "%s: open('%s', flags=%04X, mode=%04o) = %d", __func__, lpath.c_str(), flags, mode, this->fd_); + debug("open('%s', flags=%04X, mode=%04o) = %d", lpath.c_str(), flags, mode, this->fd_); if (this->fd_ == -1) vfsThrowErrno("could not open '%s'", lpath.c_str()); } diff --git a/src/VfsNs.cpp b/src/VfsNs.cpp index 125b127..64db5f7 100644 --- a/src/VfsNs.cpp +++ b/src/VfsNs.cpp @@ -106,7 +106,7 @@ void VfsCatalog::changeDir(const std::string& path) throw (DmException) lpath = getLocalPath(path); wrapCall(chdir(lpath.c_str())); - syslog(LOG_DEBUG, "%s: changed to '%s'", __func__, lpath.c_str()); + debug("changed to '%s'", lpath.c_str()); } @@ -567,7 +567,7 @@ void VfsCatalog::updateExtendedAttributes(const std::string& path, for (it = oldXattrs.begin(); it != oldXattrs.end(); it++) { key = it->first; value = Extensible::anyToString(it->second); - syslog(LOG_DEBUG, "%s: removing '%s' = '%s' from '%s'", __func__, key.c_str(), value.c_str(), lpath.c_str()); + debug("removing '%s' = '%s' from '%s'", key.c_str(), value.c_str(), lpath.c_str()); wrapCall(attr_remove(lpath.c_str(), key.c_str(), 0), "could not remove '%s' on '%s'", key.c_str(), path.c_str()); } } @@ -608,7 +608,7 @@ Directory* VfsCatalog::openDir(const std::string& path) throw (DmException) lpath = getLocalPath(path); privateDir = vfsOpenDir(lpath, path); - syslog(LOG_DEBUG, "%s: directory '%s' opened", __func__, lpath.c_str()); + debug("directory '%s' opened", lpath.c_str()); return privateDir; } @@ -629,7 +629,7 @@ void VfsCatalog::closeDir(Directory* dir) throw (DmException) delete privateDir; wrapCall(r, "error closing directory '%s'", path.c_str()); - syslog(LOG_DEBUG, "%s: directory '%s' closed", __func__, lpath.c_str()); + debug("directory '%s' closed", lpath.c_str()); } @@ -647,7 +647,7 @@ struct dirent* VfsCatalog::readDir(Directory* dir) throw (DmException) if (!ent && errno) vfsThrow(errno, "readdir() on '%s' failed", privateDir->path.c_str()); - syslog(LOG_DEBUG, "%s: result %s", __func__, ent ? ent->d_name : "(null)"); + debug("result %s", ent ? ent->d_name : "(null)"); return static_cast(ent); } @@ -875,11 +875,11 @@ Extensible VfsCatalog::vfsGetXattrs(const std::string& path, const std::string& entry = ATTR_ENTRY(this->buffer, i); // "selinux" is returned in the list, but failing to get the value if (strcmp(entry->a_name, "selinux") == 0) { - //syslog(LOG_DEBUG, "%s: skipping attribute '%s'", __func__, entry->a_name); + //debug("skipping attribute '%s'", entry->a_name); } else { len = sizeof this->xattrValue; wrapCall(attr_get(lpath.c_str(), entry->a_name, this->xattrValue, &len, follow ? 0 : ATTR_DONTFOLLOW), "could not get extended attribute '%s' on '%s'", entry->a_name, path.c_str()); - syslog(LOG_DEBUG, "%s: '%s' = '%.*s'", __func__, entry->a_name, len, this->xattrValue); + debug("'%s' = '%.*s'", entry->a_name, len, this->xattrValue); attrValue.assign(this->xattrValue, len); xattrs[entry->a_name] = attrValue; } @@ -894,15 +894,15 @@ Extensible VfsCatalog::vfsGetXattrs(const std::string& path, const std::string& void VfsCatalog::vfsSetXattr(const std::string& path, const std::string& lpath, const std::string key, const std::string value, int flags) { switch (flags & (ATTR_REPLACE | ATTR_CREATE)) { case ATTR_REPLACE: - syslog(LOG_DEBUG, "%s: replacing '%s' -> '%s' on '%s'", __func__, key.c_str(), value.c_str(), lpath.c_str()); + debug("replacing '%s' -> '%s' on '%s'", key.c_str(), value.c_str(), lpath.c_str()); wrapCall(attr_set(lpath.c_str(), key.c_str(), value.c_str(), value.size(), flags), "could not replace extended attribute '%s' on '%s'", key.c_str(), path.c_str()); break; case ATTR_CREATE: - syslog(LOG_DEBUG, "%s: creating '%s' -> '%s' on '%s'", __func__, key.c_str(), value.c_str(), lpath.c_str()); + debug("creating '%s' -> '%s' on '%s'", key.c_str(), value.c_str(), lpath.c_str()); wrapCall(attr_set(lpath.c_str(), key.c_str(), value.c_str(), value.size(), flags), "could not create extended attribute '%s' on '%s'", key.c_str(), path.c_str()); break; default: - syslog(LOG_DEBUG, "%s: setting '%s' -> '%s' on '%s'", __func__, key.c_str(), value.c_str(), lpath.c_str()); + debug("setting '%s' -> '%s' on '%s'", key.c_str(), value.c_str(), lpath.c_str()); wrapCall(attr_set(lpath.c_str(), key.c_str(), value.c_str(), value.size(), flags), "could not set extended attribute '%s' on '%s'", key.c_str(), path.c_str()); break; } @@ -917,7 +917,7 @@ regex_t *VfsCatalog::vfsCompileRegex(const char *name, const std::string value) if (value.empty()) return 0; - //syslog(LOG_DEBUG, "%s: %s regex: '%s'\n", __func__, name, value.c_str()); + //debug("%s regex: '%s'\n", name, value.c_str()); if ((ret = regcomp(®ex, value.c_str(), REG_EXTENDED | REG_NOSUB)) != 0) { regerror(ret, ®ex, buf, sizeof buf); vfsThrow(EINVAL, "invalid regular expresion for '%s': %s", name, buf); diff --git a/src/VfsPool.cpp b/src/VfsPool.cpp index 6a4d3e8..4682d7f 100644 --- a/src/VfsPool.cpp +++ b/src/VfsPool.cpp @@ -176,7 +176,7 @@ Location VfsPoolManager::whereToWrite(const std::string& path) throw (DmExceptio // Create the entry if it does not exist already // Note: the expected behavior is to truncate and keep mode if it does - syslog(LOG_DEBUG, "%s: calling catalog->create('%s', 0644)", __func__, path.c_str()); + debug("calling catalog->create('%s', 0644)", path.c_str()); this->stack_->getCatalog()->create(path, 0644); // TODO: no support for overwriting //if (!acl.empty())