当前位置: 首页>>代码示例>>C++>>正文


C++ SuperLogger::set_log_target方法代码示例

本文整理汇总了C++中SuperLogger::set_log_target方法的典型用法代码示例。如果您正苦于以下问题:C++ SuperLogger::set_log_target方法的具体用法?C++ SuperLogger::set_log_target怎么用?C++ SuperLogger::set_log_target使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SuperLogger的用法示例。


在下文中一共展示了SuperLogger::set_log_target方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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();
}
开发者ID:johnhaddon,项目名称:appleseed,代码行数:51,代码来源:main.cpp

示例2: main

int main(int argc, char* argv[])
{
    // Enable memory tracking immediately as to catch as many leaks as possible.
    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")));
    application.setAttribute(Qt::AA_DontUseNativeMenuBar, true);

    // The locale must be set after the construction of QApplication.
    QLocale::setDefault(QLocale::C);

    // QApplication sets C locale to the user's locale, we need to fix this.
    std::setlocale(LC_ALL, "C");

    // QT changes locale when loading image from disk for the very first time.
    // The problem was tracked for both QImage and QPixmap.
    // Both classes in their `load()` function call `QImageReader.read()`
    // which results in change of the locale back to system settings.
    // This is a dirty fix which loads any image at the very beginning and
    // resets the locale right after, thus preventing the `QImageReader.read()`
    // to change it again (as it happens only on the very first `read`).
    // Issue reported and tracked on GitHub under reference #1435.
    QImageReader(make_app_path("icons/icon.png")).read();   // any image

    // Make sure this build can run on this host.
    check_compatibility();

    // Make sure appleseed is correctly installed.
    check_installation();

    // Parse the command line.
    SuperLogger logger;
#ifdef _WIN32
    // On Windows, we will display command line arguments in a message box
    // so we need to capture CommandLineHandler's output into a string.
    logger.set_log_target(create_string_log_target());
#endif
    CommandLineHandler cl;
    cl.parse(argc, const_cast<const char**>(argv), logger);

    // Configure the application to use our default stylesheet file.
    set_default_stylesheet(application);

    // Create the application's main window.
    appleseed::studio::MainWindow window;

    // Initialize the python interpreter and load plugins.
    PythonInterpreter::instance().set_main_window(&window);
    PythonInterpreter::instance().load_plugins();

    // If a project file was specified on the command line, open it and optionally start rendering.
    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_async(filename);
        }
    }

    window.show();

    return application.exec();
}
开发者ID:dcoeurjo,项目名称:appleseed,代码行数:78,代码来源:main.cpp


注:本文中的SuperLogger::set_log_target方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。