MCPcopy Create free account
hub / github.com/apache/brpc / GetDefaultLogFile

Function GetDefaultLogFile

src/butil/logging.cc:236–255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

234#endif
235
236PathString GetDefaultLogFile() {
237#if defined(OS_WIN)
238 // On Windows we use the same path as the exe.
239 wchar_t module_name[MAX_PATH];
240 GetModuleFileName(NULL, module_name, MAX_PATH);
241
242 PathString log_file = module_name;
243 PathString::size_type last_backslash =
244 log_file.rfind('\\', log_file.size());
245 if (last_backslash != PathString::npos)
246 log_file.erase(last_backslash + 1);
247 log_file += L"debug.log";
248 return log_file;
249#elif defined(OS_LINUX)
250 return GetProcessName() + ".log";
251#elif defined(OS_POSIX)
252 // On other platforms we just use the current directory.
253 return PathString("debug.log");
254#endif
255}
256
257// This class acts as a wrapper for locking the logging files.
258// LoggingLock::Init() should be called from the main thread before any logging

Callers 3

InitMethod · 0.85
InitializeLogFileHandleFunction · 0.85
BaseInitLoggingImplFunction · 0.85

Calls 4

rfindMethod · 0.80
GetProcessNameFunction · 0.70
sizeMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected