Add DEBUG environment variable for scripts.
authorGuus Sliepen <guus@tinc-vpn.org>
Tue, 21 Mar 2017 20:25:27 +0000 (21:25 +0100)
committerGuus Sliepen <guus@tinc-vpn.org>
Tue, 21 Mar 2017 20:25:27 +0000 (21:25 +0100)
This contains the current debug level used by tinc. Scripts can use it
to decide whether to log debugging information of their own.

Closes #138 on GitHub.

src/script.c

index ceb6a1b..1ce59ea 100644 (file)
@@ -105,6 +105,8 @@ void environment_init(environment_t *env) {
                environment_add(env, "DEVICE=%s", device);
        if(iface)
                environment_add(env, "INTERFACE=%s", iface);
+       if(debug_level >= 0)
+               environment_add(env, "DEBUG=%d", debug_level);
 }
 
 void environment_exit(environment_t *env) {