"...source/algorithms/ConvertToDiffractionMDWorkspace-v1.rst" did not exist on "a939408dbb6dd9720226cc3cbf52be8e6146b19a"
Newer
Older
@return True if paraview is available or not disabled.
bool ConfigServiceImpl::pvPluginsAvailable() const {
std::string pvpluginsDir = getString("pvplugins.directory");
return !pvpluginsDir.empty();
/**
* Gets the path to the ParaView plugins
* @returns A string giving the directory of the ParaView plugins
*/
const std::string ConfigServiceImpl::getPVPluginsPath() const {
return getString("pvplugins.directory");
/*
Gets the system proxy information
@url A url to match the proxy to
@return the proxy information.
*/
Kernel::ProxyInfo &ConfigServiceImpl::getProxy(const std::string &url) {
if (!m_isProxySet) {
// set the proxy
// first check if the proxy is defined in the properties file
std::string proxyHost;
int proxyPort;
if ((getValue("proxy.host", proxyHost) == 1) &&
(getValue("proxy.port", proxyPort) == 1)) {
// set it from the config values
m_proxyInfo = ProxyInfo(proxyHost, proxyPort, true);
} else {
// get the system proxy
Poco::URI uri(url);
Mantid::Kernel::NetworkProxy proxyHelper;
m_proxyInfo = proxyHelper.getHttpProxy(uri.toString());
m_isProxySet = true;
}
return m_proxyInfo;
}
/** Sets the log level priority for the File log channel
* @param logLevel the integer value of the log level to set, 1=Critical, 7=Debug
*/
void ConfigServiceImpl::setFileLogLevel(int logLevel) {
setFilterChannelLogLevel(m_filterChannels[0], logLevel);
}
/** Sets the log level priority for the Console log channel
* @param logLevel the integer value of the log level to set, 1=Critical, 7=Debug
*/
void ConfigServiceImpl::setConsoleLogLevel(int logLevel) {
setFilterChannelLogLevel(m_filterChannels[1], logLevel);
}
/** Sets the Log level for a filter channel
* @param filterChannelName the channel name of the filter channel to change
* @param logLevel the integer value of the log level to set, 1=Critical, 7=Debug
* @throws std::invalid_argument if the channel name is incorrect or it is not a
* filterChannel
*/
void ConfigServiceImpl::setFilterChannelLogLevel(
const std::string &filterChannelName, int logLevel) {
Poco::Channel *channel = nullptr;
try {
channel = Poco::LoggingRegistry::defaultRegistry().channelForName(
filterChannelName);
} catch (Poco::NotFoundException &) {
throw std::invalid_argument(filterChannelName +
" not found in the Logging Registry");
auto *filterChannel = dynamic_cast<Poco::FilterChannel *>(channel);
if (filterChannel) {
filterChannel->setPriority(logLevel);
int lowestLogLevel = FindLowestFilterLevel();
// set root level if required
int rootLevel = Poco::Logger::root().getLevel();
if (rootLevel != lowestLogLevel) {
Mantid::Kernel::Logger::setLevelForAll(lowestLogLevel);
g_log.log(filterChannelName + " log channel set to " +
Logger::PriorityNames[logLevel] + " priority",
static_cast<Logger::Priority>(logLevel));
} else {
throw std::invalid_argument(filterChannelName +
" was not a filter channel");
/** Finds the lowest Log level for all registered filter channels
int ConfigServiceImpl::FindLowestFilterLevel() const {
int lowestPriority = Logger::Priority::PRIO_FATAL;
// Find the lowest level of all of the filter channels
for (const auto &filterChannelName : m_filterChannels) {
auto *channel = Poco::LoggingRegistry::defaultRegistry().channelForName(
filterChannelName);
auto *filterChannel = dynamic_cast<Poco::FilterChannel *>(channel);
if (filterChannel) {
int filterPriority = filterChannel->getPriority();
if (filterPriority > lowestPriority) {
lowestPriority = filterPriority;
}
}
} catch (Poco::NotFoundException &) {
g_log.warning(filterChannelName +
" registered log filter channel not found");
}
}
return lowestPriority;
}
Campbell, Stuart
committed
/// \cond TEMPLATE
template DLLExport int ConfigServiceImpl::getValue(const std::string &,
double &);
template DLLExport int ConfigServiceImpl::getValue(const std::string &,
std::string &);
template DLLExport int ConfigServiceImpl::getValue(const std::string &, int &);
template DLLExport int ConfigServiceImpl::getValue(const std::string &,
std::size_t &);
Campbell, Stuart
committed
/// \endcond TEMPLATE
} // namespace Kernel
} // namespace Mantid