summaryrefslogtreecommitdiff
path: root/libbb/logenv.c
diff options
context:
space:
mode:
authorMichel Stam2014-11-04 12:19:04 +0100
committerDenys Vlasenko2014-11-04 12:19:04 +0100
commitd3fabf89d7d38a436672ac2deea7904351b1b12a (patch)
treebaae6201eb8c0b2b74a1732762c3034efcb4a00e /libbb/logenv.c
parentfdd957bdc9981cc2c1efb4452f55bb44a88cbfe0 (diff)
downloadbusybox-d3fabf89d7d38a436672ac2deea7904351b1b12a.zip
busybox-d3fabf89d7d38a436672ac2deea7904351b1b12a.tar.gz
zcip: Add environment variable for overriding log functionality
function old new delta bb_logenv_override - 70 +70 packed_usage 29969 30033 +64 zcip_main 1426 1431 +5 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 2/0 up/down: 139/0) Total: 139 bytes Signed-off-by: Michel Stam <m.stam@fugro.nl> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/logenv.c')
-rw-r--r--libbb/logenv.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/libbb/logenv.c b/libbb/logenv.c
new file mode 100644
index 0000000..66c60bd
--- /dev/null
+++ b/libbb/logenv.c
@@ -0,0 +1,24 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * Utility routines.
+ *
+ * Copyright (C) 2014 by Fugro Intersite B.V. <m.stam@fugro.nl>
+ *
+ * Licensed under GPLv2 or later, see file LICENSE in this source tree.
+ */
+#include "libbb.h"
+
+void FAST_FUNC bb_logenv_override(void)
+{
+ const char* mode = getenv("LOGGING");
+
+ if (!mode)
+ return;
+
+ if (strcmp(mode, "none") == 0)
+ logmode = LOGMODE_NONE;
+#if ENABLE_FEATURE_SYSLOG
+ else if (strcmp(mode, "syslog") == 0)
+ logmode = LOGMODE_SYSLOG;
+#endif
+}