Browse Source

main: logging enabled from command line

bboozzoo/device-cache
Maciek Borzecki 10 years ago
parent
commit
52c6266ec0
1 changed files with 19 additions and 0 deletions
  1. +19
    -0
      src/main.vala

+ 19
- 0
src/main.vala View File

@ -17,9 +17,28 @@
* AUTHORS
* Maciek Borzecki <maciek.borzecki (at] gmail.com>
*/
private static bool log_debug = false;
private const GLib.OptionEntry[] options = {
{"debug", 'd', 0, OptionArg.NONE, ref log_debug, "Show debug output", null},
{null}
};
public static int main(string[] args)
{
try {
var opt_context = new OptionContext ("mconnect");
opt_context.set_help_enabled (true);
opt_context.add_main_entries (options, null);
opt_context.parse (ref args);
} catch (OptionError e) {
stdout.printf ("error: %s\n", e.message);
stdout.printf ("Run '%s --help' to see a full list of available command line options.\n", args[0]);
return 0;
}
if (log_debug == true)
Environment.set_variable("G_MESSAGES_DEBUG", "all", false);
Notify.init("mconnect");
var core = Core.instance();


Loading…
Cancel
Save