gflags isn't initialized when REGISTER_MODULE_INITIALIZER is invoked,
we couldn't initialize vmodule_list properly. Modified to call
VLOG2Initializer in the first call of InitVLOG3__.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@8
eb4d4688-79bd-11dd-afb4-
1d65580434c0
// Boolean initialization flag.
static bool inited_vmodule = false;
// Boolean initialization flag.
static bool inited_vmodule = false;
static void VLOG2Initializer() {
static void VLOG2Initializer() {
- MutexLock l(&vmodule_lock);
+ vmodule_lock.AssertHeld();
// Can now parse --vmodule flag and initialize mapping of module-specific
// logging levels.
inited_vmodule = false;
// Can now parse --vmodule flag and initialize mapping of module-specific
// logging levels.
inited_vmodule = false;
-REGISTER_MODULE_INITIALIZER(vlog_is_on, VLOG2Initializer());
-
// This can be called very early, so we use SpinLock and RAW_VLOG here.
int SetVLOGLevel(const char* module_pattern, int log_level) {
int result = FLAGS_v;
// This can be called very early, so we use SpinLock and RAW_VLOG here.
int SetVLOGLevel(const char* module_pattern, int log_level) {
int result = FLAGS_v;
const char* fname, int32 verbose_level) {
MutexLock l(&vmodule_lock);
bool read_vmodule_flag = inited_vmodule;
const char* fname, int32 verbose_level) {
MutexLock l(&vmodule_lock);
bool read_vmodule_flag = inited_vmodule;
- if (!read_vmodule_flag && vmodule_list == 0) {
- // The command line --vmodule flags haven't been parsed
- // and nothing was set with SetVLOGLevel yet,
- // but *site_default (usually FLAGS_v) might be manually set
- // by some early-executing code, or else it's still 0.
- return *site_default >= verbose_level;
+ if (!read_vmodule_flag) {
+ VLOG2Initializer();
}
// protect the errno global in case someone writes:
}
// protect the errno global in case someone writes: