| 780 | delete_old(APPEND_TO_OLD_LOG_FILE) {} |
| 781 | |
| 782 | bool BaseInitLoggingImpl(const LoggingSettings& settings) { |
| 783 | #if defined(OS_NACL) |
| 784 | // Can log only to the system debug log. |
| 785 | CHECK_EQ(settings.logging_dest & ~LOG_TO_SYSTEM_DEBUG_LOG, 0); |
| 786 | #endif |
| 787 | |
| 788 | logging_destination = settings.logging_dest; |
| 789 | |
| 790 | // ignore file options unless logging to file is set. |
| 791 | if ((logging_destination & LOG_TO_FILE) == 0) |
| 792 | return true; |
| 793 | |
| 794 | LoggingLock::Init(settings.lock_log, settings.log_file); |
| 795 | LoggingLock logging_lock; |
| 796 | |
| 797 | // Calling InitLogging twice or after some log call has already opened the |
| 798 | // default log file will re-initialize to the new options. |
| 799 | CloseLogFileUnlocked(); |
| 800 | |
| 801 | if (!log_file_name) |
| 802 | log_file_name = new PathString(); |
| 803 | if (settings.log_file) { |
| 804 | *log_file_name = settings.log_file; |
| 805 | } else { |
| 806 | *log_file_name = GetDefaultLogFile(); |
| 807 | } |
| 808 | if (settings.delete_old == DELETE_OLD_LOG_FILE) |
| 809 | DeleteFilePath(*log_file_name); |
| 810 | |
| 811 | return InitializeLogFileHandle(); |
| 812 | } |
| 813 | |
| 814 | void SetMinLogLevel(int level) { |
| 815 | FLAGS_minloglevel = std::min(BLOG_FATAL, level); |
no test coverage detected