* Initialize global loggers. * * Note that this is called very early in the process lifetime, so you should be * careful about what global state you rely on here. */
| 825 | * careful about what global state you rely on here. |
| 826 | */ |
| 827 | void InitLogging() |
| 828 | { |
| 829 | g_logger->m_print_to_file = !gArgs.IsArgNegated("-debuglogfile"); |
| 830 | g_logger->m_file_path = AbsPathForConfigVal(gArgs.GetArg("-debuglogfile", DEFAULT_DEBUGLOGFILE)); |
| 831 | |
| 832 | // Add newlines to the logfile to distinguish this execution from the last |
| 833 | // one; called before console logging is set up, so this is only sent to |
| 834 | // debug.log. |
| 835 | LogPrintf("\n\n\n\n\n"); |
| 836 | |
| 837 | g_logger->m_print_to_console = gArgs.GetBoolArg("-printtoconsole", !gArgs.GetBoolArg("-daemon", false)); |
| 838 | g_logger->m_log_timestamps = gArgs.GetBoolArg("-logtimestamps", DEFAULT_LOGTIMESTAMPS); |
| 839 | g_logger->m_log_time_micros = gArgs.GetBoolArg("-logtimemicros", DEFAULT_LOGTIMEMICROS); |
| 840 | |
| 841 | fLogIPs = gArgs.GetBoolArg("-logips", DEFAULT_LOGIPS); |
| 842 | |
| 843 | std::string version_string = FormatFullVersion(); |
| 844 | #ifdef DEBUG |
| 845 | version_string += " (debug build)"; |
| 846 | #else |
| 847 | version_string += " (release build)"; |
| 848 | #endif |
| 849 | LogPrintf(PACKAGE_NAME " version %s\n", version_string); |
| 850 | } |
| 851 | |
| 852 | namespace { // Variables internal to initialization process only |
| 853 |
no test coverage detected