#include "absl/log/internal/vlog_config.h"
#include <stddef.h>
#include <algorithm>
#include <atomic>
#include <functional>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "absl/base/attributes.h"
#include "absl/base/config.h"
#include "absl/base/const_init.h"
#include "absl/base/internal/spinlock.h"
#include "absl/base/no_destructor.h"
#include "absl/base/optimization.h"
#include "absl/base/thread_annotations.h"
#include "absl/log/internal/fnmatch.h"
#include "absl/memory/memory.h"
#include "absl/strings/numbers.h"
#include "absl/strings/str_split.h"
#include "absl/strings/string_view.h"
#include "absl/strings/strip.h"
#include "absl/synchronization/mutex.h"
#include "absl/types/optional.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace log_internal {
namespace {
bool ModuleIsPath(absl::string_view module_pattern) { … }
}
bool VLogSite::SlowIsEnabled(int stale_v, int level) { … }
bool VLogSite::SlowIsEnabled0(int stale_v) { … }
bool VLogSite::SlowIsEnabled1(int stale_v) { … }
bool VLogSite::SlowIsEnabled2(int stale_v) { … }
bool VLogSite::SlowIsEnabled3(int stale_v) { … }
bool VLogSite::SlowIsEnabled4(int stale_v) { … }
bool VLogSite::SlowIsEnabled5(int stale_v) { … }
namespace {
struct VModuleInfo final { … };
ABSL_CONST_INIT absl::base_internal::SpinLock mutex(
absl::kConstInit, absl::base_internal::SCHEDULE_KERNEL_ONLY);
absl::Mutex* GetUpdateSitesMutex() { … }
ABSL_CONST_INIT int global_v ABSL_GUARDED_BY(mutex) = …;
ABSL_CONST_INIT std::atomic<VLogSite*> site_list_head{ … };
ABSL_CONST_INIT std::vector<VModuleInfo>* vmodule_info ABSL_GUARDED_BY(mutex)
ABSL_PT_GUARDED_BY(mutex){ … };
ABSL_CONST_INIT std::vector<std::function<void()>>* update_callbacks
ABSL_GUARDED_BY(GetUpdateSitesMutex())
ABSL_PT_GUARDED_BY(GetUpdateSitesMutex()){ … };
std::vector<VModuleInfo>& get_vmodule_info()
ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex) { … }
int VLogLevel(absl::string_view file, const std::vector<VModuleInfo>* infos,
int current_global_v) { … }
int AppendVModuleLocked(absl::string_view module_pattern, int log_level)
ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex) { … }
int PrependVModuleLocked(absl::string_view module_pattern, int log_level)
ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex) { … }
}
int VLogLevel(absl::string_view file) ABSL_LOCKS_EXCLUDED(mutex) { … }
int RegisterAndInitialize(VLogSite* v) ABSL_LOCKS_EXCLUDED(mutex) { … }
void UpdateVLogSites() ABSL_UNLOCK_FUNCTION(mutex)
ABSL_LOCKS_EXCLUDED(GetUpdateSitesMutex()) { … }
void UpdateVModule(absl::string_view vmodule)
ABSL_LOCKS_EXCLUDED(mutex, GetUpdateSitesMutex()) { … }
int UpdateGlobalVLogLevel(int v)
ABSL_LOCKS_EXCLUDED(mutex, GetUpdateSitesMutex()) { … }
int PrependVModule(absl::string_view module_pattern, int log_level)
ABSL_LOCKS_EXCLUDED(mutex, GetUpdateSitesMutex()) { … }
void OnVLogVerbosityUpdate(std::function<void()> cb)
ABSL_LOCKS_EXCLUDED(GetUpdateSitesMutex()) { … }
VLogSite* SetVModuleListHeadForTestOnly(VLogSite* v) { … }
}
ABSL_NAMESPACE_END
}