Blender  V3.3
logging.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2011 Blender Foundation. All rights reserved. */
3 
4 #include <gflags/gflags.h>
5 
6 #include "intern/logging.h"
7 #include "intern/utildefines.h"
9 
10 static bool is_verbosity_set() {
11  using LIBMV_GFLAGS_NAMESPACE::GetCommandLineOption;
12 
13  std::string verbosity;
14  if (!GetCommandLineOption("v", &verbosity)) {
15  return false;
16  }
17  return verbosity != "0";
18 }
19 
20 void libmv_initLogging(const char* argv0) {
21  using LIBMV_GFLAGS_NAMESPACE::SetCommandLineOption;
22  google::InitGoogleLogging(argv0);
23  SetCommandLineOption("logtostderr", "1");
24  if (!is_verbosity_set()) {
25  SetCommandLineOption("v", "0");
26  }
27  SetCommandLineOption("stderrthreshold", "0");
28  SetCommandLineOption("minloglevel", "0");
29 }
30 
32  using LIBMV_GFLAGS_NAMESPACE::SetCommandLineOption;
33  SetCommandLineOption("logtostderr", "1");
34  if (!is_verbosity_set()) {
35  SetCommandLineOption("v", "2");
36  }
37  SetCommandLineOption("stderrthreshold", "0");
38  SetCommandLineOption("minloglevel", "0");
39 }
40 
41 void libmv_setLoggingVerbosity(int verbosity) {
42  using LIBMV_GFLAGS_NAMESPACE::SetCommandLineOption;
43  char val[10];
44  snprintf(val, sizeof(val), "%d", verbosity);
45  SetCommandLineOption("v", val);
46 }
#define snprintf
Definition: BLI_winstuff.h:53
void libmv_setLoggingVerbosity(int verbosity)
Definition: logging.cc:41
void libmv_startDebugLogging(void)
Definition: logging.cc:31
void libmv_initLogging(const char *argv0)
Definition: logging.cc:20
static bool is_verbosity_set()
Definition: logging.cc:10