本文整理汇总了C++中SuperLogger类的典型用法代码示例。如果您正苦于以下问题:C++ SuperLogger类的具体用法?C++ SuperLogger怎么用?C++ SuperLogger使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SuperLogger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: print_program_usage
void CommandLineHandler::print_program_usage(
const char* program_name,
SuperLogger& logger) const
{
SaveLogFormatterConfig save_config(logger);
logger.set_format(LogMessage::Info, "{message}");
LOG_INFO(logger, "usage: %s [project.appleseed]", program_name);
LOG_INFO(logger, "options:");
parser().print_usage(logger);
#ifdef _WIN32
const StringLogTarget& target =
static_cast<const StringLogTarget&>(logger.get_log_target());
const QString str = QString::fromStdString(target.get_string());
QMessageBox msgbox;
msgbox.setWindowTitle("appleseed.studio Program Usage");
msgbox.setIcon(QMessageBox::Information);
msgbox.setText("<pre>" + str + "</pre>");
msgbox.setStandardButtons(QMessageBox::Ok);
msgbox.setDefaultButton(QMessageBox::Ok);
msgbox.exec();
#endif
}
示例2: main
int main(int argc, const char* argv[])
{
SuperLogger logger;
Application::check_installation(logger);
CommandLineHandler cl;
cl.parse(argc, argv, logger);
global_logger().add_target(&logger.get_log_target());
// Construct the schema filename.
const filesystem::path schema_path =
filesystem::path(Application::get_root_path())
/ "schemas/project.xsd";
// Load the input project from disk.
ProjectFileReader reader;
auto_release_ptr<Project> project(
reader.read(
cl.m_filename.values()[0].c_str(),
schema_path.file_string().c_str()));
// Bail out if the project couldn't be loaded.
if (project.get() == 0)
return 1;
// Write the project back to disk.
return ProjectFileWriter::write(project.ref()) ? 0 : 1;
}
示例3: main
int main(int argc, const char* argv[])
{
// Initialize the logger that will be used throughout the program.
SuperLogger logger;
// Make sure appleseed is correctly installed.
Application::check_installation(logger);
// Parse the command line.
CommandLineHandler cl;
cl.parse(argc, argv, logger);
// Load an apply settings from the settings file.
Dictionary settings;
Application::load_settings("appleseed.tools.xml", settings, logger);
logger.configure_from_settings(settings);
// Apply command line arguments.
cl.apply(logger);
// Configure the renderer's global logger.
// Must be done after settings have been loaded and the command line
// has been parsed, because these two operations may replace the log
// target of the global logger.
global_logger().initialize_from(logger);
// Retrieve the command line arguments.
const string& input_filepath = cl.m_filenames.values()[0];
const string& output_filepath = cl.m_filenames.values()[1];
const FluffParams params(cl);
// Construct the schema file path.
const bf::path schema_filepath =
bf::path(Application::get_root_path())
/ "schemas"
/ "project.xsd";
// Read the input project from disk.
ProjectFileReader reader;
auto_release_ptr<Project> project(
reader.read(
input_filepath.c_str(),
schema_filepath.string().c_str()));
// Bail out if the project couldn't be loaded.
if (project.get() == 0)
return 1;
// Fluffify the project.
make_fluffy(project.ref(), params);
// Write the project back to disk.
const bool success =
ProjectFileWriter::write(
project.ref(),
output_filepath.c_str());
return success ? 0 : 1;
}
示例4: print_program_usage
void CommandLineHandler::print_program_usage(
const char* executable_name,
SuperLogger& logger) const
{
SaveLogFormatterConfig save_config(logger);
logger.set_verbosity_level(LogMessage::Info);
logger.set_format(LogMessage::Info, "{message}");
LOG_INFO(logger, "usage: %s [options] master.appleseed output.appleseed", executable_name);
LOG_INFO(logger, "options:");
parser().print_usage(logger);
}
示例5: main
int main(int argc, char* argv[])
{
start_memory_tracking();
// Our message handler must be set before the construction of QApplication.
g_previous_message_handler = qInstallMsgHandler(message_handler);
QApplication application(argc, argv);
QApplication::setOrganizationName("appleseedhq");
QApplication::setOrganizationDomain("appleseedhq.net");
QApplication::setApplicationName("appleseed.studio");
QApplication::setApplicationVersion(Appleseed::get_lib_version());
QApplication::setWindowIcon(QIcon(make_app_path("icons/appleseed.png")));
// The locale must be set after the construction of QApplication.
QLocale::setDefault(QLocale::C);
setlocale(LC_ALL, "C");
check_installation();
// Parse the command line.
SuperLogger logger;
#ifdef _WIN32
logger.set_log_target(create_string_log_target());
#endif
CommandLineHandler cl;
cl.parse(argc, const_cast<const char**>(argv), logger);
configure_application(application);
appleseed::studio::MainWindow window;
if (!cl.m_filename.values().empty())
{
const QString filename = QString::fromStdString(cl.m_filename.value());
if (cl.m_render.is_set())
{
const QString configuration = QString::fromStdString(cl.m_render.value());
window.open_and_render_project(filename, configuration);
}
else
{
window.open_project(filename);
}
}
window.show();
return application.exec();
}
示例6: main
int main(int argc, const char* argv[])
{
SuperLogger logger;
Application::check_installation(logger);
CommandLineHandler cl;
cl.parse(argc, argv, logger);
// Initialize the renderer's logger.
global_logger().add_target(&logger.get_log_target());
// Retrieve the input file path.
const string& input_filepath = cl.m_filename.value();
// Construct the schema file path.
const filesystem::path schema_filepath =
filesystem::path(Application::get_root_path())
/ "schemas"
/ "project.xsd";
// Read the input project from disk.
// Note: it is crucial that we read mesh files as well, so that we can collect
// material slots declared by objects. Material slots are required by the project
// file updater, for instance when migrating projects from rev. 7 to rev. 8.
ProjectFileReader reader;
auto_release_ptr<Project> project(
reader.read(
input_filepath.c_str(),
schema_filepath.string().c_str(),
ProjectFileReader::OmitProjectFileUpdate));
// Bail out if the project couldn't be loaded.
if (project.get() == 0)
return 1;
// Update the project file to the desired revision.
ProjectFileUpdater updater;
if (cl.m_to_revision.is_set())
updater.update(project.ref(), cl.m_to_revision.value());
else updater.update(project.ref());
// Write the project back to disk.
const bool success =
ProjectFileWriter::write(
project.ref(),
project->get_path(),
ProjectFileWriter::OmitWritingGeometryFiles | ProjectFileWriter::OmitBringingAssets);
return success ? 0 : 1;
}
示例7: print_system_information
void CommandLineHandlerBase::print_system_information(SuperLogger& logger)
{
SaveLogFormatterConfig save_config(logger);
logger.set_format(LogMessage::Info, "{message}");
System::print_information(logger);
}
示例8: main
int main(int argc, const char* argv[])
{
SuperLogger logger;
Application::check_installation(logger);
CommandLineHandler cl;
cl.parse(argc, argv, logger);
global_logger().add_target(&logger.get_log_target());
// Retrieve the input file path.
const string& input_filepath = cl.m_filename.values()[0];
// Construct the schema file path.
const string schema_filepath =
(filesystem::path(Application::get_root_path())
/ "schemas" / "project.xsd").string();
// Load the input project from disk.
ProjectFileReader reader;
auto_release_ptr<Project> project(
reader.read(
input_filepath.c_str(),
schema_filepath.c_str(),
ProjectFileReader::OmitReadingMeshFiles | ProjectFileReader::OmitProjectFileUpdate));
// Bail out if the project couldn't be loaded.
if (project.get() == 0)
return 1;
// Update the project file to the desired revision.
ProjectFileUpdater updater;
if (cl.m_to_revision.is_set())
updater.update(project.ref(), cl.m_to_revision.values()[0]);
else updater.update(project.ref());
// Write the project back to disk.
const bool success =
ProjectFileWriter::write(
project.ref(),
project->get_path(),
ProjectFileWriter::OmitWritingMeshFiles | ProjectFileWriter::OmitCopyingAssets);
return success ? 0 : 1;
}
示例9: parse
void CommandLineHandlerBase::parse(const int argc, const char* argv[], SuperLogger& logger)
{
impl->m_executable_name = bf::path(argv[0]).filename().string();
impl->m_parser.parse(argc, argv, impl->m_parse_results);
if (impl->m_help.is_set())
{
print_program_usage(impl->m_executable_name.c_str(), logger);
exit(EXIT_SUCCESS);
}
if (impl->m_message_coloring.is_set())
logger.enable_message_coloring();
if (impl->m_message_verbosity.is_set())
logger.set_verbosity_level_from_string(impl->m_message_verbosity.value().c_str());
}
示例10: main
int main(int argc, const char* argv[])
{
SuperLogger logger;
Application::check_installation(logger);
CommandLineHandler cl;
cl.parse(argc, argv, logger);
// Initialize the renderer's logger.
global_logger().add_target(&logger.get_log_target());
// Retrieve the command line arguments.
const string& input_filepath = cl.m_filenames.values()[0];
const string& output_filepath = cl.m_filenames.values()[1];
const FluffParams params(cl);
// Construct the schema file path.
const filesystem::path schema_filepath =
filesystem::path(Application::get_root_path())
/ "schemas"
/ "project.xsd";
// Read the input project from disk.
ProjectFileReader reader;
auto_release_ptr<Project> project(
reader.read(
input_filepath.c_str(),
schema_filepath.string().c_str()));
// Bail out if the project couldn't be loaded.
if (project.get() == 0)
return 1;
// Fluffify the project.
make_fluffy(project.ref(), params);
// Write the project back to disk.
const bool success =
ProjectFileWriter::write(
project.ref(),
output_filepath.c_str());
return success ? 0 : 1;
}
示例11: print_program_usage
void CommandLineHandler::print_program_usage(
const char* program_name,
SuperLogger& logger) const
{
SaveLogFormatterConfig save_config(logger);
logger.set_format(LogMessage::Info, "{message}");
LOG_INFO(logger, "usage: %s [options] input-file output-file", program_name);
LOG_INFO(logger, "options:");
parser().print_usage(logger);
}
示例12: main
int main(int argc, const char* argv[])
{
start_memory_tracking();
SuperLogger logger;
Application::check_installation(logger);
g_cl.parse(argc, argv, logger);
// Read the application's settings from disk.
load_settings(logger);
if (g_settings.get_optional<bool>("message_coloring", false))
logger.enable_message_coloring();
// Run unit tests.
if (g_cl.m_run_unit_tests.is_set())
run_unit_tests(logger);
// Run unit benchmarks.
if (g_cl.m_run_unit_benchmarks.is_set())
run_unit_benchmarks(logger);
// Dump entity definitions.
if (g_cl.m_dump_entity_definitions.is_set())
dump_entity_definitions(logger);
// Render the specified project.
if (!g_cl.m_filenames.values().empty())
{
const string project_filename = g_cl.m_filenames.values().front();
if (g_cl.m_benchmark_mode.is_set())
benchmark_render(project_filename, logger);
else render(project_filename, logger);
}
return 0;
}
示例13: print_program_usage
void CommandLineHandler::print_program_usage(
const char* program_name,
SuperLogger& logger) const
{
LogTargetBase& log_target = logger.get_log_target();
const LogMessage::FormattingFlags old_flags =
log_target.set_formatting_flags(LogMessage::Info, LogMessage::DisplayMessage);
LOG_INFO(logger, "usage: %s [options] project.appleseed", program_name);
LOG_INFO(logger, "options:");
parser().print_usage(logger);
log_target.set_formatting_flags(LogMessage::Info, old_flags);
}
示例14: parse
void CommandLineHandlerBase::parse(
const int argc,
const char* argv[],
SuperLogger& logger)
{
ParseResults results;
impl->m_parser.parse(argc, argv, results);
if (impl->m_message_coloring.is_set())
logger.enable_message_coloring();
if (impl->m_message_verbosity.is_set())
set_verbosity(logger, impl->m_message_verbosity.value());
if (impl->m_version.is_set())
print_version_information(logger);
if (impl->m_system.is_set())
print_system_information(logger);
if (impl->m_help.is_set())
{
const string program_name = filesystem::path(argv[0]).filename().string();
print_program_usage(program_name.c_str(), logger);
exit(0);
}
if (impl->m_display_options.is_set())
{
LOG_INFO(logger, "recognized options:");
impl->m_parser.print_recognized_options(logger);
}
results.m_messages.print(logger);
if (results.m_errors > 0 || results.m_warnings > 0)
{
LOG(
logger,
results.m_errors > 0 ? LogMessage::Fatal : LogMessage::Warning,
FMT_SIZE_T " error%s, " FMT_SIZE_T " warning%s encountered while parsing the command line.",
results.m_errors,
results.m_errors > 1 ? "s" : "",
results.m_warnings,
results.m_warnings > 1 ? "s" : "");
}
}
示例15: print_version_information
void CommandLineHandlerBase::print_version_information(SuperLogger& logger) const
{
SaveLogFormatterConfig save_config(logger);
logger.set_format(LogMessage::Info, "{message}");
LOG_INFO(
logger,
"%s, using %s version %s, %s configuration\n"
"compiled on %s at %s using %s version %s\n"
"copyright (c) 2010-2013 Francois Beaune, Jupiter Jazz Limited.\n"
"copyright (c) 2014 Francois Beaune, The appleseedhq Organization.\n"
"this software is released under the MIT license (http://www.opensource.org/licenses/mit-license.php).\n"
"visit http://appleseedhq.net/ for additional information and resources.",
impl->m_application_name.c_str(),
Appleseed::get_lib_name(),
Appleseed::get_lib_version(),
Appleseed::get_lib_configuration(),
Appleseed::get_lib_compilation_date(),
Appleseed::get_lib_compilation_time(),
Compiler::get_compiler_name(),
Compiler::get_compiler_version());
}