[tracker/sam/debug: 2/4] Remove TRACKER_VERBOSITY and tracker-log module



commit 5aac1111209caf33fa82acc0c206b3a2165cb76e
Author: Sam Thursfield <sam afuera me uk>
Date:   Mon Apr 20 01:17:24 2020 +0200

    Remove TRACKER_VERBOSITY and tracker-log module
    
    Users should now use G_MESSAGES_DEBUG=Tracker to see debug messages
    on the console.
    
    The TRACKER_VERBOSITY only worked if tracker_log_init() had been called,
    which can't be done when libtracker-sparql is being used from an
    application outside of Tracker.

 .gitlab-ci.yml                                |   5 +-
 HACKING.md                                    |  12 +-
 docs/reference/libtracker-sparql/overview.xml |  44 ----
 src/libtracker-common/libtracker-common.vapi  |   6 -
 src/libtracker-common/meson.build             |   1 -
 src/libtracker-common/tracker-common.h        |   1 -
 src/libtracker-common/tracker-enums.h         |   7 -
 src/libtracker-common/tracker-file-utils.c    |   1 -
 src/libtracker-common/tracker-language.c      |   1 -
 src/libtracker-common/tracker-log.c           | 321 --------------------------
 src/libtracker-common/tracker-log.h           |  37 ---
 src/libtracker-common/tracker-type-utils.c    |   1 -
 src/tracker/tracker-main.c                    |   7 -
 tests/functional-tests/fixtures.py            |   2 +-
 tests/libtracker-data/tracker-sparql-test.c   |   2 -
 utils/trackertestutils/__main__.py            |  29 +--
 16 files changed, 9 insertions(+), 468 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index a2375a1f1..7a72f06d5 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -4,7 +4,8 @@
 variables:
   # These can be used to see verbose log output from the functional-tests.
   # See HACKING.md for more information.
-  TRACKER_VERBOSITY: "1"
+  G_MESSAGES_DEBUG: "Tracker"
+  TRACKER_DEBUG: ""
   TRACKER_TESTS_VERBOSE: "no"
 
   # This can be used when debugging test failures that only occur within GitLab CI.
@@ -37,8 +38,8 @@ stages:
       echo
       echo "Test suite settings:"
       echo
+      echo "G_MESSAGES_DEBUG: ${G_MESSAGES_DEBUG}"
       echo "TRACKER_DEBUG: ${TRACKER_DEBUG}"
-      echo "TRACKER_VERBOSITY: ${TRACKER_VERBOSITY}"
       echo "TRACKER_TESTS_VERBOSE: ${TRACKER_TESTS_VERBOSE}"
       echo "MESON_TEST_EXTRA_ARGS: ${MESON_TEST_EXTRA_ARGS}"
       echo
diff --git a/HACKING.md b/HACKING.md
index 671d48195..61a40e192 100644
--- a/HACKING.md
+++ b/HACKING.md
@@ -31,17 +31,11 @@ OpenSuSE do automated whole-system testing that includes the GNOME desktop for t
 
 The following environment variables control logging from Tracker daemons:
 
+  * `G_MESSAGES_DEBUG`: controls log output from all GLib-based libraries
+    in the current process. Use `G_MESSAGES_DEBUG=Tracker` to see Tracker
+    related messages, or `G_MESSAGES_DEBUG=all` to see everything.
   * `TRACKER_DEBUG`: takes a comma-separated list of keywords to enable
     extra debugging output. Use the keyword 'help' for a list of keywords.
-  * `TRACKER_VERBOSITY`: takes a value of 1, 2 or 3 and causes increasing
-    amounts of log output from Tracker code to be written to stdout.
-  * `G_MESSAGES_DEBUG`: controls log output from GLib-based libraries that
-    are used in the Tracker process. Use `G_MESSAGES_DEBUG=all` for maximal
-    log output.
-
-Internally, Tracker will set `G_MESSAGES_DEBUG=Tracker` if `TRACKER_VERBOSITY`
-is set and `G_MESSAGES_DEBUG` is not set, to enable printing of its own log
-messages to stdout.
 
 You can set these variables when using `tracker-sandbox`, and when running the
 Tracker test suite. Note that Meson will not print log output from tests by
diff --git a/docs/reference/libtracker-sparql/overview.xml b/docs/reference/libtracker-sparql/overview.xml
index 02a164218..0e746e1a1 100644
--- a/docs/reference/libtracker-sparql/overview.xml
+++ b/docs/reference/libtracker-sparql/overview.xml
@@ -40,48 +40,4 @@
         <function><link 
linkend="tracker-sparql-connection-remote-new">tracker_sparql_connection_remote_new</link></function>.
     </para>
   </chapter>
-
-  <chapter id="tracker-overview-environment-variables">
-    <title>Environment Variables</title>
-
-    <para>
-      There are a number of environment variables which affect the way
-      that the libtracker-sparql library will do its work. Those
-      environment variables are described here.
-
-      <itemizedlist>
-       <listitem>
-         <emphasis>TRACKER_USE_LOG_FILES</emphasis>
-         <para>
-           Don't just log to stdout and stderr, but to log files too
-           which are kept in $HOME/.local/share/tracker/. This came
-           into effect in 0.15.3 and 0.16.0. After this version of
-           Tracker, logging to file (usually useful for debugging)
-           can only be done by declaring this environment variable.
-         </para>
-       </listitem>
-       <listitem>
-         <emphasis>TRACKER_USE_CONFIG_FILES</emphasis>
-         <para>
-           Don't use GSettings, instead use a config file similar to
-           how settings were saved in 0.10.x. That is, a file which
-           is much like an .ini file. These are saved to
-           $HOME/.config/tracker/
-         </para>
-       </listitem>
-       <listitem>
-         <emphasis>TRACKER_VERBOSITY</emphasis>
-         <para>
-           Lets you choose the log level for libtracker-sparql.
-           configuration to control it. Values range
-           from <emphasis>0</emphasis> to <emphasis>3</emphasis>,
-           0=errors, 1=minimal, 2=detailed, 3=debug. By default it
-           is <emphasis>0</emphasis>.
-         </para>
-       </listitem>
-      </itemizedlist>
-    </para>
-
-  </chapter>
-
 </part>
diff --git a/src/libtracker-common/libtracker-common.vapi b/src/libtracker-common/libtracker-common.vapi
index fa38e9f28..2946f52fc 100644
--- a/src/libtracker-common/libtracker-common.vapi
+++ b/src/libtracker-common/libtracker-common.vapi
@@ -61,12 +61,6 @@ namespace Tracker {
                public static void save_directory_list (void *object, string property, GLib.KeyFile key_file, 
string group, string key);
        }
 
-       [CCode (cheader_filename = "libtracker-common/tracker-common.h")]
-       namespace Log {
-               public bool init (int verbosity, out string used_filename);
-               public void shutdown ();
-       }
-
        [CCode (cheader_filename = "libtracker-common/tracker-locale.h")]
        namespace Locale {
                public void sanity_check ();
diff --git a/src/libtracker-common/meson.build b/src/libtracker-common/meson.build
index 11e610d09..e2909e429 100644
--- a/src/libtracker-common/meson.build
+++ b/src/libtracker-common/meson.build
@@ -14,7 +14,6 @@ tracker_common_sources = [
   'tracker-date-time.c',
   'tracker-debug.c',
   'tracker-file-utils.c',
-  'tracker-log.c',
   'tracker-type-utils.c',
   'tracker-utils.c',
   'tracker-locale.c',
diff --git a/src/libtracker-common/tracker-common.h b/src/libtracker-common/tracker-common.h
index 0a9267ed9..f30aeeb52 100644
--- a/src/libtracker-common/tracker-common.h
+++ b/src/libtracker-common/tracker-common.h
@@ -32,7 +32,6 @@
 #include "tracker-debug.h"
 #include "tracker-file-utils.h"
 #include "tracker-language.h"
-#include "tracker-log.h"
 #include "tracker-parser.h"
 #include "tracker-type-utils.h"
 #include "tracker-utils.h"
diff --git a/src/libtracker-common/tracker-enums.h b/src/libtracker-common/tracker-enums.h
index 2b315e067..d54b97b90 100644
--- a/src/libtracker-common/tracker-enums.h
+++ b/src/libtracker-common/tracker-enums.h
@@ -22,13 +22,6 @@
 
 G_BEGIN_DECLS
 
-typedef enum {
-       TRACKER_VERBOSITY_ERRORS,
-       TRACKER_VERBOSITY_MINIMAL,
-       TRACKER_VERBOSITY_DETAILED,
-       TRACKER_VERBOSITY_DEBUG,
-} TrackerVerbosity;
-
 typedef enum {
        TRACKER_SERIALIZATION_FORMAT_SPARQL,
        TRACKER_SERIALIZATION_FORMAT_TURTLE,
diff --git a/src/libtracker-common/tracker-file-utils.c b/src/libtracker-common/tracker-file-utils.c
index 53e39128b..1962a23d2 100644
--- a/src/libtracker-common/tracker-file-utils.c
+++ b/src/libtracker-common/tracker-file-utils.c
@@ -38,7 +38,6 @@
 #include <glib/gstdio.h>
 #include <gio/gio.h>
 
-#include "tracker-log.h"
 #include "tracker-file-utils.h"
 #include "tracker-type-utils.h"
 
diff --git a/src/libtracker-common/tracker-language.c b/src/libtracker-common/tracker-language.c
index 97fc41158..d0a47c012 100644
--- a/src/libtracker-common/tracker-language.c
+++ b/src/libtracker-common/tracker-language.c
@@ -28,7 +28,6 @@
 #include <libstemmer.h>
 #endif /* HAVE_LIBSTEMMER */
 
-#include "tracker-log.h"
 #include "tracker-language.h"
 
 typedef struct _TrackerLanguagePrivate TrackerLanguagePrivate;
diff --git a/src/libtracker-common/tracker-type-utils.c b/src/libtracker-common/tracker-type-utils.c
index 63f89dc87..37a095f20 100644
--- a/src/libtracker-common/tracker-type-utils.c
+++ b/src/libtracker-common/tracker-type-utils.c
@@ -30,7 +30,6 @@
 
 #include <glib.h>
 
-#include "tracker-log.h"
 #include "tracker-utils.h"
 #include "tracker-type-utils.h"
 
diff --git a/src/tracker/tracker-main.c b/src/tracker/tracker-main.c
index 7120fd79a..a1250eba4 100644
--- a/src/tracker/tracker-main.c
+++ b/src/tracker/tracker-main.c
@@ -122,16 +122,9 @@ run_builtin (struct cmd_struct *p, int argc, const char **argv)
 static void
 handle_command (int argc, const char **argv)
 {
-       gchar *log_filename = NULL;
        char *cmd = g_path_get_basename (argv[0]);
        int i;
 
-       tracker_log_init (0, &log_filename);
-       if (log_filename != NULL) {
-               g_message ("Using log file:'%s'", log_filename);
-               g_free (log_filename);
-       }
-
        for (i = 0; i < G_N_ELEMENTS (commands); i++) {
                struct cmd_struct *p = commands + i;
 
diff --git a/tests/functional-tests/fixtures.py b/tests/functional-tests/fixtures.py
index 7e715c3f0..b42d742c4 100644
--- a/tests/functional-tests/fixtures.py
+++ b/tests/functional-tests/fixtures.py
@@ -53,7 +53,7 @@ def tracker_test_main():
     else:
         # Output some messages from D-Bus daemon to stderr by default. In practice,
         # only errors and warnings should be output here unless the environment
-        # contains G_MESSAGES_DEBUG= and/or TRACKER_VERBOSITY=1 or more.
+        # contains G_MESSAGES_DEBUG=.
         handler_stderr = logging.StreamHandler(stream=sys.stderr)
         handler_stderr.addFilter(logging.Filter('trackertestutils.dbusdaemon.stderr'))
         handler_stdout = logging.StreamHandler(stream=sys.stderr)
diff --git a/tests/libtracker-data/tracker-sparql-test.c b/tests/libtracker-data/tracker-sparql-test.c
index f4864b8b0..49689f187 100644
--- a/tests/libtracker-data/tracker-sparql-test.c
+++ b/tests/libtracker-data/tracker-sparql-test.c
@@ -488,8 +488,6 @@ main (int argc, char **argv)
 
        setlocale (LC_COLLATE, "en_US.utf8");
 
-       tracker_log_init (0, NULL);
-
        current_dir = g_get_current_dir ();
        tests_data_dir = g_build_filename (current_dir, "sparql-test-data-XXXXXX", NULL);
        g_free (current_dir);
diff --git a/utils/trackertestutils/__main__.py b/utils/trackertestutils/__main__.py
index 9812ffd2c..e41138383 100644
--- a/utils/trackertestutils/__main__.py
+++ b/utils/trackertestutils/__main__.py
@@ -86,7 +86,7 @@ def environment_set_and_add_path(env, var, prefix, suffix):
     env[var] = full
 
 
-def create_sandbox(index_location, prefix=None, verbosity=0, dbus_config=None,
+def create_sandbox(index_location, prefix=None, dbus_config=None,
                    interactive=False):
     assert prefix is None or dbus_config is None
 
@@ -107,8 +107,6 @@ def create_sandbox(index_location, prefix=None, verbosity=0, dbus_config=None,
     # Preferences
     extra_env['G_MESSAGES_PREFIXED'] = 'all'
 
-    extra_env['TRACKER_VERBOSITY'] = str(verbosity)
-
     log.debug('Using prefix location "%s"' % prefix)
     log.debug('Using index location "%s"' % index_location)
 
@@ -188,9 +186,6 @@ def argument_parser():
                         help="run Tracker from the given install prefix. You "
                              "can run the system version of Tracker by "
                              "specifying --prefix=/usr")
-    parser.add_argument('-v', '--verbosity', default=None,
-                        choices=['0', '1', '2', '3', 'errors', 'minimal', 'detailed', 'debug'],
-                        help="show debugging info from Tracker processes")
     parser.add_argument('-i', '--index', metavar='DIR', action=expand_path,
                         default=default_index_location, dest='index_location',
                         help=f"directory to the index (default={default_index_location})")
@@ -214,16 +209,6 @@ def argument_parser():
     return parser
 
 
-def verbosity_as_int(verbosity):
-    verbosity_map = {
-        'errors': 0,
-        'minimal': 1,
-        'detailed': 2,
-        'debug': 3
-    }
-    return verbosity_map.get(verbosity, int(verbosity))
-
-
 def init_logging(debug_sandbox, debug_dbus):
     SANDBOX_FORMAT = "%(name)s: %(message)s"
     DBUS_FORMAT = "%(message)s"
@@ -353,16 +338,6 @@ def main():
             "Note that running Tracker from the build tree implies "
             "--dbus-config.")
 
-    if args.verbosity is None:
-        verbosity = verbosity_as_int(os.environ.get('TRACKER_VERBOSITY', 0))
-    else:
-        verbosity = verbosity_as_int(args.verbosity)
-        if 'TRACKER_VERBOSITY' in os.environ:
-            if verbosity != int(os.environ['TRACKER_VERBOSITY']):
-                raise RuntimeError("Incompatible values for TRACKER_VERBOSITY "
-                                   "from environment and from --verbosity "
-                                   "parameter.")
-
     if args.command is None and args.wait_for_miner is not None:
         raise RuntimeError("--wait-for-miner cannot be used when opening an "
                            "interactive shell.")
@@ -380,7 +355,7 @@ def main():
     interactive = not (args.command)
 
     # Set up environment variables and foo needed to get started.
-    sandbox = create_sandbox(index_location, args.prefix, verbosity,
+    sandbox = create_sandbox(index_location, args.prefix,
                              dbus_config=args.dbus_config,
                              interactive=interactive)
     config_set(sandbox)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]