Add the ability to specify log file location and severity level (issue #172).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@164 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2011-01-24 20:41:07 +00:00
parent 013c008775
commit 442cc1b89f
4 changed files with 50 additions and 7 deletions

View File

@ -66,14 +66,29 @@ CefProcessUIThread::~CefProcessUIThread() {
void CefProcessUIThread::Init() {
PlatformInit();
#ifndef _DEBUG
// Only log error messages and above in release build.
logging::SetMinLogLevel(logging::LOG_ERROR);
#endif
// Initialize the global CommandLine object.
CommandLine::Init(0, NULL);
const CefSettings& settings = _Context->settings();
// Initialize logging.
logging::LoggingDestination logging_dest;
if (settings.log_severity == LOGSEVERITY_DISABLE) {
logging_dest = logging::LOG_NONE;
} else {
#if defined(OS_WIN)
logging_dest = logging::LOG_ONLY_TO_FILE;
#else
logging_dest = logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG;
#endif
logging::SetMinLogLevel(settings.log_severity);
}
FilePath log_file = FilePath(CefString(&settings.log_file));
logging::InitLogging(log_file.value().c_str(), logging_dest,
logging::DONT_LOCK_LOG_FILE, logging::APPEND_TO_OLD_LOG_FILE,
logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS);
// Initialize WebKit.
webkit_init_ = new BrowserWebKitInit();
@ -123,8 +138,6 @@ void CefProcessUIThread::Init() {
_Context->set_storage_context(new DOMStorageContext());
}
const CefSettings& settings = _Context->settings();
if (settings.user_agent.length > 0)
webkit_glue::SetUserAgent(CefString(&settings.user_agent));