本文整理汇总了C++中Log::SetTimeStamp方法的典型用法代码示例。如果您正苦于以下问题:C++ Log::SetTimeStamp方法的具体用法?C++ Log::SetTimeStamp怎么用?C++ Log::SetTimeStamp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Log
的用法示例。
在下文中一共展示了Log::SetTimeStamp方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}