本文整理汇总了C++中LogLevel函数的典型用法代码示例。如果您正苦于以下问题:C++ LogLevel函数的具体用法?C++ LogLevel怎么用?C++ LogLevel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LogLevel函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: LogLevel
bool Log::SetLogLevel(std::string const& name, const char* newLevelc, bool isLogger /* = true */)
{
LogLevel newLevel = LogLevel(atoi(newLevelc));
if (newLevel < 0)
return false;
if (isLogger)
{
LoggerMap::iterator it = loggers.begin();
while (it != loggers.end() && it->second.getName() != name)
++it;
if (it == loggers.end())
return false;
it->second.setLogLevel(newLevel);
if (newLevel != LOG_LEVEL_DISABLED && newLevel < lowestLogLevel)
lowestLogLevel = newLevel;
}
else
{
Appender* appender = GetAppenderByName(name);
if (!appender)
return false;
appender->setLogLevel(newLevel);
}
return true;
}
开发者ID:piaoasd123,项目名称:ServerTest,代码行数:31,代码来源:Log.cpp
示例2: uint8
void Log::CreateLoggerFromConfig(std::string const& appenderName)
{
if (appenderName.empty())
return;
LogLevel level = LOG_LEVEL_DISABLED;
uint8 type = uint8(-1);
std::string options = sConfigMgr->GetStringDefault(appenderName.c_str(), "");
std::string name = appenderName.substr(7);
if (options.empty())
{
fprintf(stderr, "Log::CreateLoggerFromConfig: Missing config option Logger.%s\n", name.c_str());
return;
}
Tokenizer tokens(options, ',');
Tokenizer::const_iterator iter = tokens.begin();
if (tokens.size() != 2)
{
fprintf(stderr, "Log::CreateLoggerFromConfig: Wrong config option Logger.%s=%s\n", name.c_str(), options.c_str());
return;
}
Logger& logger = loggers[name];
if (!logger.getName().empty())
{
fprintf(stderr, "Error while configuring Logger %s. Already defined\n", name.c_str());
return;
}
level = LogLevel(atoi(*iter));
if (level > LOG_LEVEL_FATAL)
{
fprintf(stderr, "Log::CreateLoggerFromConfig: Wrong Log Level %u for logger %s\n", type, name.c_str());
return;
}
logger.Create(name, level);
//fprintf(stdout, "Log::CreateLoggerFromConfig: Created Logger %s, Level %u\n", name.c_str(), level);
++iter;
std::istringstream ss(*iter);
std::string str;
ss >> str;
while (ss)
{
if (Appender* appender = GetAppenderByName(str))
{
logger.addAppender(appender->getId(), appender);
//fprintf(stdout, "Log::CreateLoggerFromConfig: Added Appender %s to Logger %s\n", appender->getName().c_str(), name.c_str());
}
else
fprintf(stderr, "Error while configuring Appender %s in Logger %s. Appender does not exist", str.c_str(), name.c_str());
ss >> str;
}
}
开发者ID:AwkwardDev,项目名称:5.4.1,代码行数:60,代码来源:Log.cpp
示例3: defined
bool LinuxHelper::SetDmxBaud(int fd) {
#if defined(HAVE_STROPTS_H) && defined(HAVE_TERMIOS2)
static const int rate = 250000;
struct termios2 tio; // linux-specific terminal stuff
if (ioctl(fd, TCGETS2, &tio) < 0) {
return false;
}
tio.c_cflag &= ~CBAUD;
tio.c_cflag |= BOTHER;
tio.c_ispeed = rate;
tio.c_ospeed = rate; // set custom speed directly
if (ioctl(fd, TCSETS2, &tio) < 0) {
return false;
}
if (LogLevel() >= OLA_LOG_INFO) {
if (ioctl(fd, TCGETS2, &tio) < 0) {
OLA_INFO << "Error getting altered settings from port";
} else {
OLA_INFO << "Port speeds for " << fd << " are " << tio.c_ispeed
<< " in and " << tio.c_ospeed << " out";
}
}
return true;
#else
return false;
(void) fd;
#endif // defined(HAVE_STROPTS_H) && defined(HAVE_TERMIOS2)
}
开发者ID:FloEdelmann,项目名称:ola,代码行数:32,代码来源:ExtendedSerial.cpp
示例4: __Log
void __Log ( const char* subsystem, int level, const char* message, ... )
{
va_list va;
va_start(va, message);
char formatBuffer[512];
sprintf(formatBuffer, "[%s] %s: %s\n", subsystem, LogLevel(level), message);
vfprintf(stderr, formatBuffer, va);
va_end(va);
}
开发者ID:gamefreak,项目名称:apollo,代码行数:9,代码来源:Logging.cpp
示例5: tokens
void Log::CreateAppenderFromConfig(std::string const& appenderName)
{
if (appenderName.empty())
return;
// Format=type, level, flags, optional1, optional2
// if type = File. optional1 = file and option2 = mode
// if type = Console. optional1 = Color
std::string options = sConfigMgr->GetStringDefault(appenderName.c_str(), "");
Tokenizer tokens(options, ',');
Tokenizer::const_iterator iter = tokens.begin();
size_t size = tokens.size();
std::string name = appenderName.substr(9);
if (size < 2)
{
fprintf(stderr, "Log::CreateAppenderFromConfig: Wrong configuration for appender %s. Config line: %s\n", name.c_str(), options.c_str());
return;
}
AppenderFlags flags = APPENDER_FLAGS_NONE;
AppenderType type = AppenderType(atoi(*iter++));
LogLevel level = LogLevel(atoi(*iter++));
if (level > LOG_LEVEL_FATAL)
{
fprintf(stderr, "Log::CreateAppenderFromConfig: Wrong Log Level %d for appender %s\n", level, name.c_str());
return;
}
if (size > 2)
flags = AppenderFlags(atoi(*iter++));
auto factoryFunction = appenderFactory.find(type);
if (factoryFunction == appenderFactory.end())
{
fprintf(stderr, "Log::CreateAppenderFromConfig: Unknown type %d for appender %s\n", type, name.c_str());
return;
}
try
{
Appender* appender = factoryFunction->second(NextAppenderId(), name, level, flags, ExtraAppenderArgs(iter, tokens.end()));
appenders[appender->getId()] = appender;
}
catch (InvalidAppenderArgsException const& iaae)
{
fprintf(stderr, "%s", iaae.what());
}
}
开发者ID:piaoasd123,项目名称:ServerTest,代码行数:52,代码来源:Log.cpp
示例6: stringToLogLevel
bool stringToLogLevel(const std::string& log_level_text, LogLevel& log_level)
{
for (size_t index = 0; index <= eLL_MUTE; ++index)
{
if (log_level_text == log_level_descriptions[index])
{
log_level = LogLevel(index);
return true;
}
}
return false;
}
开发者ID:HumaRobotics,项目名称:fzi_icl_core,代码行数:13,代码来源:LogLevel.cpp
示例7: LogLevel
void Logger::handle(LogItem item)
{
LogLevel level = LogLevel(item.getLevel());
if (level > mMaxLevel) mMaxLevel = level;
/* Stuff happens here */
/* Done happening */
if (level > mSignalLevel)
qFatal(qPrintable("***SIGNAL: " + item.toString()));
else if (level > mExceptionLevel)
qFatal(qPrintable("***EXEPTION: " + item.toString()));
else if (level > mQuitLevel)
qFatal(qPrintable("***QUIT: " + item.toString()));
}
开发者ID:eirTony,项目名称:delete-antworkz-imf,代码行数:16,代码来源:Logger.cpp
示例8: LogPrintfVerbatim
/**
* Verbatim output of the given log-message if LogLevel() >= level
*/
void
LogPrintfVerbatim (LogLevel_t level, const char* format, ...)
{
if ( LogLevel() < level )
return;
va_list va;
va_start(va, format);
/* simply print this to output */
vfprintf (LogFile(), format, va );
fflush(LogFile());
va_end(va);
} /* LogPrintfVerbatim() */
开发者ID:spxiwh,项目名称:lalsuite,代码行数:20,代码来源:LogPrintf.c
示例9: LogPrintf
/**
* Output the given log-message, prefixed by a timestamp and level, if LogLevel() >= level
*/
void
LogPrintf (LogLevel_t level, const char* format, ...)
{
if ( LogLevel() < level )
return;
va_list va;
va_start(va, format);
fprintf(LogFile(), "%s (%d) [%s]: ", LogGetTimestamp(), getpid(), LogFormatLevel(level) );
vfprintf(LogFile(), format, va);
fflush(LogFile());
va_end(va);
} /* LogPrintf() */
开发者ID:spxiwh,项目名称:lalsuite,代码行数:20,代码来源:LogPrintf.c
示例10: set_log_level
void set_log_level(LogLevel l) {
// snap to max level
if (l > IMP_HAS_LOG) {
l = LogLevel(IMP_HAS_LOG);
}
#if IMP_BASE_HAS_LOG4CXX
try {
switch (l) {
case PROGRESS:
case SILENT:
get_logger()->setLevel(log4cxx::Level::getOff());
break;
case WARNING:
get_logger()->setLevel(log4cxx::Level::getWarn());
break;
case TERSE:
get_logger()->setLevel(log4cxx::Level::getInfo());
break;
case VERBOSE:
get_logger()->setLevel(log4cxx::Level::getDebug());
break;
case MEMORY:
get_logger()->setLevel(log4cxx::Level::getTrace());
break;
case DEFAULT:
case ALL_LOG:
default:
IMP_WARN("Unknown log level " << boost::lexical_cast<std::string>(l));
}
}
catch (log4cxx::helpers::Exception &) {
IMP_THROW("Invalid log level", ValueException);
}
#else
IMP_USAGE_CHECK(l >= SILENT && l < ALL_LOG,
"Setting log to invalid level: " << l);
#endif
IMP_OMP_PRAGMA(critical(imp_log))
if (internal::log_level != l) {
internal::log_level = l;
}
}
开发者ID:newtonjoo,项目名称:imp,代码行数:42,代码来源:log.cpp
示例11: foreach
LogItem::Key Logger::enqueue(LogItem item)
{
LogItem::Key key = item.getItemKey();
LogLevel level = item.getLevel();
if ( ! key || ! level ) return 0;
/* Stuff happens here */
/* Done happening */
/* Output to Forks */
foreach(LogFork * fork, mNameForkMap.values()) fork->write(item);
/* Clean up and save */
item.clearFormatted();
mItemQueue.enqueue(item);
if (LogLevel::Preamble == LogLevel(level)) mPreambleList.append(item);
handle(item);
return key;
}
开发者ID:eirTony,项目名称:delete-antworkz-imf,代码行数:20,代码来源:Logger.cpp
示例12: show_seed
"Show all command line arguments including advanced ones and exit.", false);
AdvancedFlag<bool> show_seed("show_seed", "Print the random seed at startup.",
false);
AdvancedFlag<CheckLevel, IMP_HAS_CHECKS != IMP_NONE> check_level(
"check_level",
"The level of checking to use: \"NONE\", \"USAGE\" or "
"\"USAGE_AND_INTERNAL\"",
CheckLevel(IMP_HAS_CHECKS));
Flag<LogLevel, IMP_HAS_LOG != IMP_SILENT> log_level("log_level",
"The log level: "
"\"SILENT\", \"WARNING\", "
"\"PROGRESS\", \"TERSE\", "
"\"VERBOSE\"",
LogLevel(WARNING));
AdvancedFlag<StatisticsLevel> stats_level(
"statistics_level",
"The level of statistics to gather: \"NONE\" or \"ALL\".",
StatisticsLevel(ALL_STATISTICS));
AdvancedFlag<bool, IMP_KERNEL_HAS_GPERFTOOLS> cpu_profile(
"cpu_profile", "Perform CPU profiling.", false);
AdvancedFlag<bool, IMP_KERNEL_HAS_GPERFTOOLS> heap_profile(
"heap_profile", "Perform heap profiling.", false);
AdvancedFlag<boost::int64_t, IMP_KERNEL_HAS_OPENMP> number_of_threads(
"number_of_threads", "Number of threads to use.", 1);
namespace {
开发者ID:AljGaber,项目名称:imp,代码行数:31,代码来源:base_static.cpp
示例13: GetTimestampStr
void Log::Initialize()
{
/// Common log files data
m_logsDir = sConfig.GetStringDefault("LogsDir","");
if (!m_logsDir.empty())
{
if ((m_logsDir.at(m_logsDir.length()-1)!='/') && (m_logsDir.at(m_logsDir.length()-1)!='\\'))
m_logsDir.append("/");
}
m_logsTimestamp = "_" + GetTimestampStr();
/// Open specific log files
logfile = openLogFile("LogFile","LogTimestamp","w");
m_gmlog_per_account = sConfig.GetBoolDefault("GmLogPerAccount",false);
if (!m_gmlog_per_account)
gmLogfile = openLogFile("GMLogFile","GmLogTimestamp","a");
else
{
// GM log settings for per account case
m_gmlog_filename_format = sConfig.GetStringDefault("GMLogFile", "");
if (!m_gmlog_filename_format.empty())
{
bool m_gmlog_timestamp = sConfig.GetBoolDefault("GmLogTimestamp",false);
size_t dot_pos = m_gmlog_filename_format.find_last_of(".");
if (dot_pos!=m_gmlog_filename_format.npos)
{
if (m_gmlog_timestamp)
m_gmlog_filename_format.insert(dot_pos,m_logsTimestamp);
m_gmlog_filename_format.insert(dot_pos,"_#%u");
}
else
{
m_gmlog_filename_format += "_#%u";
if (m_gmlog_timestamp)
m_gmlog_filename_format += m_logsTimestamp;
}
m_gmlog_filename_format = m_logsDir + m_gmlog_filename_format;
}
}
charLogfile = openLogFile("CharLogFile","CharLogTimestamp","a");
dberLogfile = openLogFile("DBErrorLogFile",NULL,"a");
raLogfile = openLogFile("RaLogFile",NULL,"a");
worldLogfile = openLogFile("WorldLogFile","WorldLogTimestamp","a");
// Main log file settings
m_includeTime = sConfig.GetBoolDefault("LogTime", false);
m_logLevel = LogLevel(sConfig.GetIntDefault("LogLevel", 0));
m_logFileLevel = LogLevel(sConfig.GetIntDefault("LogFileLevel", 0));
InitColors(sConfig.GetStringDefault("LogColors", ""));
m_logFilter = 0;
if (sConfig.GetBoolDefault("LogFilter_TransportMoves", true))
m_logFilter |= LOG_FILTER_TRANSPORT_MOVES;
if (sConfig.GetBoolDefault("LogFilter_CreatureMoves", true))
m_logFilter |= LOG_FILTER_CREATURE_MOVES;
if (sConfig.GetBoolDefault("LogFilter_VisibilityChanges", true))
m_logFilter |= LOG_FILTER_VISIBILITY_CHANGES;
if (sConfig.GetBoolDefault("LogFilter_AchievementUpdates", true))
m_logFilter |= LOG_FILTER_ACHIEVEMENT_UPDATES;
if (sConfig.GetBoolDefault("LogFilter_Weather", true))
m_logFilter |= LOG_FILTER_WEATHER;
if (sConfig.GetBoolDefault("LogFilter_SQLText", false))
m_logFilter |= LOG_FILTER_SQL_TEXT;
if (sConfig.GetBoolDefault("LogFilter_PlayerMoves", false))
m_logFilter |= LOG_FILTER_PLAYER_MOVES;
if (sConfig.GetBoolDefault("LogFilter_PeriodicAffects", false))
m_logFilter |= LOG_FILTER_PERIODIC_AFFECTS;
if (sConfig.GetBoolDefault("LogFilter_AIAndMovegens", false))
m_logFilter |= LOG_FILTER_AI_AND_MOVEGENSS;
// Char log settings
m_charLog_Dump = sConfig.GetBoolDefault("CharLogDump", false);
}
开发者ID:BruceLeet,项目名称:mangos,代码行数:82,代码来源:Log.cpp
示例14: tokens
void Log::CreateAppenderFromConfig(const char* name)
{
if (!name || *name == '\0')
return;
// Format=type,level,flags,optional1,optional2
// if type = File. optional1 = file and option2 = mode
// if type = Console. optional1 = Color
std::string options = "Appender.";
options.append(name);
options = ConfigMgr::GetStringDefault(options.c_str(), "");
Tokenizer tokens(options, ',');
Tokenizer::const_iterator iter = tokens.begin();
if (tokens.size() < 2)
{
fprintf(stderr, "Log::CreateAppenderFromConfig: Wrong configuration for appender %s. Config line: %s\n", name, options.c_str());
return;
}
AppenderFlags flags = APPENDER_FLAGS_NONE;
AppenderType type = AppenderType(atoi(*iter));
++iter;
LogLevel level = LogLevel(atoi(*iter));
if (level > LOG_LEVEL_FATAL)
{
fprintf(stderr, "Log::CreateAppenderFromConfig: Wrong Log Level %d for appender %s\n", level, name);
return;
}
if (++iter != tokens.end())
flags = AppenderFlags(atoi(*iter));
switch (type)
{
case APPENDER_CONSOLE:
{
AppenderConsole* appender = new AppenderConsole(NextAppenderId(), name, level, flags);
appenders[appender->getId()] = appender;
if (++iter != tokens.end())
appender->InitColors(*iter);
//fprintf(stdout, "Log::CreateAppenderFromConfig: Created Appender %s (%u), Type CONSOLE, Mask %u\n", appender->getName().c_str(), appender->getId(), appender->getLogLevel()); // DEBUG - RemoveMe
break;
}
case APPENDER_FILE:
{
std::string filename;
std::string mode = "a";
if (++iter == tokens.end())
{
fprintf(stderr, "Log::CreateAppenderFromConfig: Missing file name for appender %s\n", name);
return;
}
filename = *iter;
if (++iter != tokens.end())
mode = *iter;
if (flags & APPENDER_FLAGS_USE_TIMESTAMP)
{
size_t dot_pos = filename.find_last_of(".");
if (dot_pos != filename.npos)
filename.insert(dot_pos, m_logsTimestamp);
else
filename += m_logsTimestamp;
}
uint8 id = NextAppenderId();
appenders[id] = new AppenderFile(id, name, level, filename.c_str(), m_logsDir.c_str(), mode.c_str(), flags);
//fprintf(stdout, "Log::CreateAppenderFromConfig: Created Appender %s (%u), Type FILE, Mask %u, File %s, Mode %s\n", name, id, level, filename.c_str(), mode.c_str()); // DEBUG - RemoveMe
break;
}
case APPENDER_DB:
{
uint8 id = NextAppenderId();
appenders[id] = new AppenderDB(id, name, level, realm);
break;
}
default:
fprintf(stderr, "Log::CreateAppenderFromConfig: Unknown type %d for appender %s\n", type, name);
break;
}
}
开发者ID:heros,项目名称:LasCore,代码行数:85,代码来源:Log.cpp
示例15: fprintf
void Log::CreateLoggerFromConfig(const char* name)
{
if (!name || *name == '\0')
return;
LogLevel level = LOG_LEVEL_DISABLED;
int32 type = -1;
std::string options = "Logger.";
options.append(name);
options = ConfigMgr::GetStringDefault(options.c_str(), "");
if (options.empty())
{
fprintf(stderr, "Log::CreateLoggerFromConfig: Missing config option Logger.%s\n", name);
return;
}
Tokenizer tokens(options, ',');
Tokenizer::const_iterator iter = tokens.begin();
if (tokens.size() != 3)
{
fprintf(stderr, "Log::CreateLoggerFromConfig: Wrong config option Logger.%s=%s\n", name, options.c_str());
return;
}
type = atoi(*iter);
if (type > MaxLogFilter)
{
fprintf(stderr, "Log::CreateLoggerFromConfig: Wrong type %u for logger %s\n", type, name);
return;
}
Logger& logger = loggers[type];
if (!logger.getName().empty())
{
fprintf(stderr, "Error while configuring Logger %s. Already defined\n", name);
return;
}
++iter;
level = LogLevel(atoi(*iter));
if (level > LOG_LEVEL_FATAL)
{
fprintf(stderr, "Log::CreateLoggerFromConfig: Wrong Log Level %u for logger %s\n", type, name);
return;
}
logger.Create(name, LogFilterType(type), level);
//fprintf(stdout, "Log::CreateLoggerFromConfig: Created Logger %s, Type %u, mask %u\n", name, LogFilterType(type), level); // DEBUG - RemoveMe
++iter;
std::istringstream ss(*iter);
std::string str;
ss >> str;
while (ss)
{
if (Appender* appender = GetAppenderByName(str))
{
logger.addAppender(appender->getId(), appender);
//fprintf(stdout, "Log::CreateLoggerFromConfig: Added Appender %s to Logger %s\n", appender->getName().c_str(), name); // DEBUG - RemoveMe
}
else
fprintf(stderr, "Error while configuring Appender %s in Logger %s. Appender does not exist", str.c_str(), name);
ss >> str;
}
}
开发者ID:heros,项目名称:LasCore,代码行数:69,代码来源:Log.cpp
示例16: QTableWidgetItem
void LogSettingsPageWidget::setState(AppSettingsGUIPageState* s) {
LogSettingsPageState* state = qobject_cast<LogSettingsPageState*>(s);
LogSettings& settings = state->settings;
tableWidget->clearContents();
tableWidget->setRowCount(1 + settings.getLoggerSettings().size());
// set header
tableWidget->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Category")));
for (int i=0; i< LogLevel_NumLevels; i++) {
QString catName = LogCategories::getLocalizedLevelName((LogLevel) i);
tableWidget->setHorizontalHeaderItem(i + 1, new QTableWidgetItem(catName) );
}
// create global line
QTableWidgetItem* item00 = new QTableWidgetItem(tr("<<all>>"));
tableWidget->setItem(0, 0, item00);
for (int i=0; i<LogLevel_NumLevels; i++) {
QTableWidgetItem* levelItem = new QTableWidgetItem();
tableWidget->setItem(0, i+1, levelItem);
LogSettingsTopLineWidget* tw = new LogSettingsTopLineWidget(this, settings.levelColors[i], LogLevel(i));
QHBoxLayout* l = new QHBoxLayout();
int marginLeft = 6; //TODO: align with usual setCheckState boxes
l->setContentsMargins(marginLeft, 1, 10, 1);
l->setSpacing(0);
tw->cb = new QCheckBox(tw);
tw->cb->setTristate(true);
connect(tw->cb, SIGNAL(stateChanged (int)), SLOT(sl_levelStateChanged(int)));
l->addWidget(tw->cb);
QLabel* label = new QLabel(tw);
updateColorLabel(label, settings.levelColors[i]);
connect(label, SIGNAL(linkActivated(const QString&)), SLOT(sl_changeColor(const QString&)));
l->addWidget(label);
tw->setLayout(l);
tableWidget->setCellWidget(0, i+1, tw);
}
// create category lines
int row=1;
int nEqual[LogLevel_NumLevels];
for (int i=0; i<LogLevel_NumLevels; i++) {
nEqual[i] = 0;
}
QList<QString> categoryNames = settings.getLoggerSettings().keys();
qSort(categoryNames);
foreach(const QString& categoryName, categoryNames) {
const LoggerSettings& cs = settings.getLoggerSettings(categoryName);
QTableWidgetItem* nameItem = new QTableWidgetItem(cs.categoryName);
tableWidget->setItem(row, 0, nameItem);
for (int i=0; i<LogLevel_NumLevels; i++) {
QTableWidgetItem* catItem = new QTableWidgetItem();
catItem->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
catItem->setCheckState(cs.activeLevelFlag[i] ? Qt::Checked : Qt::Unchecked);
nEqual[i] += cs.activeLevelFlag[i] ? 1 : 0;
tableWidget->setItem(row, i+1, catItem);
}
row++;
}
for (int i=0; i<LogLevel_NumLevels; i++) {
LogSettingsTopLineWidget* tw = qobject_cast<LogSettingsTopLineWidget*>(tableWidget->cellWidget(0, i+1));
tw->cb->setCheckState(nEqual[i] == 0 ? Qt::Unchecked : nEqual[i] == settings.getLoggerSettings().size() ? Qt::Checked : Qt::PartiallyChecked);
}
tableWidget->resizeRowsToContents();
connect(tableWidget, SIGNAL(itemChanged(QTableWidgetItem *)), this, SLOT(sl_catItemStateChanged(QTableWidgetItem *)));
showCategoryCB->setChecked(settings.showCategory);
showDateCB->setChecked(settings.showDate);
showLevelCB->setChecked(settings.showLevel);
colorCB->setChecked(settings.enableColor);
dateFormatEdit->setText(settings.logPattern);
fileOutCB->setChecked(settings.toFile);
saveController->setPath(settings.outputFile);
sl_outFileStateChanged(settings.toFile ? Qt::Checked : Qt::Unchecked);
}
开发者ID:ugeneunipro,项目名称:ugene-old,代码行数:84,代码来源:LogSettingsGUIController.cpp
示例17: LogFile
/** Decide where to print log messages */
static FILE* LogFile(void)
{
if (LogLevel() < LOG_NORMAL)
return stderr; // Error log messages are printed to standard error
return stdout; // All other log messages are printed to standard output
}
开发者ID:spxiwh,项目名称:lalsuite,代码行数:7,代码来源:LogPrintf.c
示例18: tokens
void Log::CreateAppenderFromConfig(std::string const& appenderName)
{
if (appenderName.empty())
return;
// Format=type, level, flags, optional1, optional2
// if type = File. optional1 = file and option2 = mode
// if type = Console. optional1 = Color
std::string options = sConfigMgr->GetStringDefault(appenderName.c_str(), "");
Tokenizer tokens(options, ',');
Tokenizer::const_iterator iter = tokens.begin();
size_t size = tokens.size();
std::string name = appenderName.substr(9);
if (size < 2)
{
fprintf(stderr, "Log::CreateAppenderFromConfig: Wrong configuration for appender %s. Config line: %s\n", name.c_str(), options.c_str());
return;
}
AppenderFlags flags = APPENDER_FLAGS_NONE;
AppenderType type = AppenderType(atoi(*iter++));
LogLevel level = LogLevel(atoi(*iter++));
if (level > LOG_LEVEL_FATAL)
{
fprintf(stderr, "Log::CreateAppenderFromConfig: Wrong Log Level %d for appender %s\n", level, name.c_str());
return;
}
if (size > 2)
flags = AppenderFlags(atoi(*iter++));
switch (type)
{
case APPENDER_CONSOLE:
{
AppenderConsole* appender = new AppenderConsole(NextAppenderId(), name, level, flags);
appenders[appender->getId()] = appender;
if (size > 3)
appender->InitColors(*iter++);
//fprintf(stdout, "Log::CreateAppenderFromConfig: Created Appender %s (%u), Type CONSOLE, Mask %u\n", appender->getName().c_str(), appender->getId(), appender->getLogLevel());
break;
}
case APPENDER_FILE:
{
std::string filename;
std::string mode = "a";
if (size < 4)
{
fprintf(stderr, "Log::CreateAppenderFromConfig: Missing file name for appender %s\n", name.c_str());
return;
}
filename = *iter++;
if (size > 4)
mode = *iter++;
if (flags & APPENDER_FLAGS_USE_TIMESTAMP)
{
size_t dot_pos = filename.find_last_of(".");
if (dot_pos != filename.npos)
filename.insert(dot_pos, m_logsTimestamp);
else
filename += m_logsTimestamp;
}
uint64 maxFileSize = 0;
if (size > 5)
maxFileSize = atoi(*iter++);
uint8 id = NextAppenderId();
appenders[id] = new AppenderFile(id, name, level, filename.c_str(), m_logsDir.c_str(), mode.c_str(), flags, maxFileSize);
//fprintf(stdout, "Log::CreateAppenderFromConfig: Created Appender %s (%u), Type FILE, Mask %u, File %s, Mode %s\n", name.c_str(), id, level, filename.c_str(), mode.c_str());
break;
}
case APPENDER_DB:
{
uint8 id = NextAppenderId();
appenders[id] = new AppenderDB(id, name, level);
break;
}
default:
fprintf(stderr, "Log::CreateAppenderFromConfig: Unknown type %d for appender %s\n", type, name.c_str());
break;
}
}
开发者ID:Kittnz,项目名称:FoxEmu,代码行数:91,代码来源:Log.cpp
示例19: LogLevel
Charts::LogLevel Charts::Impl::getLogLevel(void)
{
return LogLevel(TR3DUtils::Log::GetLevel());
}
开发者ID:AndroidT,项目名称:TRCharts,代码行数:4,代码来源:ChartsImpl.cpp
注:本文中的LogLevel函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论