本文整理汇总了C++中Log::SetQuiet方法的典型用法代码示例。如果您正苦于以下问题:C++ Log::SetQuiet方法的具体用法?C++ Log::SetQuiet怎么用?C++ Log::SetQuiet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Log
的用法示例。
在下文中一共展示了Log::SetQuiet方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Initialize
bool Engine::Initialize(const VariantMap& parameters)
{
if (initialized_)
return true;
PROFILE(InitEngine);
// Set headless mode
headless_ = GetParameter(parameters, "Headless", false).GetBool();
// Register the rest of the subsystems
if (!headless_)
{
context_->RegisterSubsystem(new Graphics(context_));
context_->RegisterSubsystem(new Renderer(context_));
}
else
{
// Register graphics library objects explicitly in headless mode to allow them to work without using actual GPU resources
RegisterGraphicsLibrary(context_);
}
// In debug mode, check now that all factory created objects can be created without crashing
#ifdef _DEBUG
const HashMap<ShortStringHash, SharedPtr<ObjectFactory> >& factories = context_->GetObjectFactories();
for (HashMap<ShortStringHash, SharedPtr<ObjectFactory> >::ConstIterator i = factories.Begin(); i != factories.End(); ++i)
SharedPtr<Object> object = i->second_->CreateObject();
#endif
// Start logging
Log* log = GetSubsystem<Log>();
if (log)
{
if (HasParameter(parameters, "LogLevel"))
log->SetLevel(GetParameter(parameters, "LogLevel").GetInt());
log->SetQuiet(GetParameter(parameters, "LogQuiet", false).GetBool());
log->Open(GetParameter(parameters, "LogName", "Urho3D.log").GetString());
}
// Set maximally accurate low res timer
GetSubsystem<Time>()->SetTimerPeriod(1);
// Configure max FPS
if (GetParameter(parameters, "FrameLimiter", true) == false)
SetMaxFps(0);
// Set amount of worker threads according to the available physical CPU cores. Using also hyperthreaded cores results in
// unpredictable extra synchronization overhead. Also reserve one core for the main thread
unsigned numThreads = GetParameter(parameters, "WorkerThreads", true).GetBool() ? GetNumPhysicalCPUs() - 1 : 0;
if (numThreads)
{
GetSubsystem<WorkQueue>()->CreateThreads(numThreads);
LOGINFO(ToString("Created %u worker thread%s", numThreads, numThreads > 1 ? "s" : ""));
}
// Add resource paths
ResourceCache* cache = GetSubsystem<ResourceCache>();
FileSystem* fileSystem = GetSubsystem<FileSystem>();
String exePath = fileSystem->GetProgramDir();
Vector<String> resourcePaths = GetParameter(parameters, "ResourcePaths", "CoreData;Data").GetString().Split(';');
Vector<String> resourcePackages = GetParameter(parameters, "ResourcePackages").GetString().Split(';');
for (unsigned i = 0; i < resourcePaths.Size(); ++i)
{
bool success = false;
// If path is not absolute, prefer to add it as a package if possible
if (!IsAbsolutePath(resourcePaths[i]))
{
String packageName = exePath + resourcePaths[i] + ".pak";
if (fileSystem->FileExists(packageName))
{
SharedPtr<PackageFile> package(new PackageFile(context_));
if (package->Open(packageName))
{
cache->AddPackageFile(package);
success = true;
}
}
if (!success)
{
String pathName = exePath + resourcePaths[i];
if (fileSystem->DirExists(pathName))
success = cache->AddResourceDir(pathName);
}
}
else
{
String pathName = resourcePaths[i];
if (fileSystem->DirExists(pathName))
success = cache->AddResourceDir(pathName);
}
if (!success)
{
LOGERROR("Failed to add resource path " + resourcePaths[i]);
return false;
//.........这里部分代码省略.........
示例2: main
int main(int argc, char** argv)
{
#ifdef WIN32
const Vector<String>& arguments = ParseArguments(GetCommandLineW());
#else
const Vector<String>& arguments = ParseArguments(argc, argv);
#endif
bool dumpApiMode = false;
String outputFile;
if (arguments.Size() < 1)
ErrorExit("Usage: ScriptCompiler <input file> [resource path for includes]\n"
" ScriptCompiler -dumpapi [output file]");
else
{
if (arguments[0] != "-dumpapi")
outputFile = arguments[0];
else
{
dumpApiMode = true;
if (arguments.Size() > 1)
outputFile = arguments[1];
}
}
SharedPtr<Context> context(new Context());
// Note: creating the Engine registers most subsystems which don't require engine initialization
SharedPtr<Engine> engine(new Engine(context));
context->RegisterSubsystem(new Script(context));
Log* log = context->GetSubsystem<Log>();
// Register Log subsystem manually if compiled without logging support
if (!log)
{
context->RegisterSubsystem(new Log(context));
log = context->GetSubsystem<Log>();
}
log->SetLevel(LOG_WARNING);
log->SetTimeStamp(false);
if (!dumpApiMode)
{
String path, file, extension;
SplitPath(outputFile, path, file, extension);
ResourceCache* cache = context->GetSubsystem<ResourceCache>();
// Add resource path to be able to resolve includes
if (arguments.Size() > 1)
cache->AddResourceDir(arguments[1]);
else
cache->AddResourceDir(cache->GetPreferredResourceDir(path));
if (!file.StartsWith("*"))
CompileScript(context, outputFile);
else
{
Vector<String> scriptFiles;
context->GetSubsystem<FileSystem>()->ScanDir(scriptFiles, path, file + extension, SCAN_FILES, false);
for (unsigned i = 0; i < scriptFiles.Size(); ++i)
CompileScript(context, path + scriptFiles[i]);
}
}
else
{
if (!outputFile.Empty())
{
log->SetQuiet(true);
log->Open(outputFile);
}
// If without output file, dump to stdout instead
context->GetSubsystem<Script>()->DumpAPI();
}
return EXIT_SUCCESS;
}