* [PATCH] send udev debug output to stdout instead of syslog
@ 2003-11-24 18:16 Olaf Hering
2003-11-24 22:32 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Olaf Hering @ 2003-11-24 18:16 UTC (permalink / raw)
To: linux-hotplug
This patch let udev talk to stderr instead of flooding the syslog.
The string UDEVDBG is maybe not the best choice.
diff -x SCCS -purNx 'klibc*' /dev/shm/udev-007/udev.c udev-007/udev.c
--- /dev/shm/udev-007/udev.c 2003-11-12 06:46:29.000000000 +0100
+++ udev-007/udev.c 2003-11-24 13:41:11.000000000 +0100
@@ -116,7 +116,15 @@ static void get_dirs(void)
strncpy(udev_config_permission_filename, udev_config_dir, sizeof(udev_config_permission_filename));
strncat(udev_config_permission_filename, udev_permission, sizeof(udev_config_permission_filename));
}
-
+int dgb_to_stdout;
+void init_dbg(void)
+{
+ if(getenv("UDEVDBG")) {
+ fprintf(stderr,"log to stderr\n");
+ dgb_to_stdout=1;
+ }
+ return;
+}
int main(int argc, char **argv, char **envp)
{
char *action;
@@ -127,6 +135,8 @@ int main(int argc, char **argv, char **e
main_argv = argv;
main_envp = envp;
+ init_dbg();
+
dbg("version %s", UDEV_VERSION);
if (argc != 2) {
diff -x SCCS -purNx 'klibc*' /dev/shm/udev-007/udev.h udev-007/udev.h
--- /dev/shm/udev-007/udev.h 2003-11-23 23:08:51.000000000 +0100
+++ udev-007/udev.h 2003-11-24 13:48:53.000000000 +0100
@@ -28,9 +28,14 @@
#ifdef DEBUG
#include <syslog.h>
+extern int dgb_to_stdout;
#define dbg(format, arg...) \
do { \
+ if(dgb_to_stdout) { \
+ fprintf (stderr , "%s: " format "\n", __FUNCTION__ , ## arg); \
+ } else { \
log_message (LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg); \
+ } \
} while (0)
#else
#define dbg(format, arg...) do { } while (0)
@@ -40,7 +45,11 @@
#ifdef DEBUG_PARSER
#define dbg_parse(format, arg...) \
do { \
+ if(dgb_to_stdout) { \
+ fprintf (stderr , "%s: " format "\n", __FUNCTION__ , ## arg); \
+ } else { \
log_message (LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg); \
+ } \
} while (0)
#else
#define dbg_parse(format, arg...) do { } while (0)
--
USB is for mice, FireWire is for men!
sUse lINUX ag, n√úRNBERG
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] send udev debug output to stdout instead of syslog
2003-11-24 18:16 [PATCH] send udev debug output to stdout instead of syslog Olaf Hering
@ 2003-11-24 22:32 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2003-11-24 22:32 UTC (permalink / raw)
To: linux-hotplug
On Mon, Nov 24, 2003 at 07:16:38PM +0100, Olaf Hering wrote:
> This patch let udev talk to stderr instead of flooding the syslog.
Why? If you use the klibc build, it sends it there anyway :)
> The string UDEVDBG is maybe not the best choice.
I agree. Also, if you were to do this, why not just modify the
log_message() function, and not increase the size of the macro?
thanks,
greg k-h
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-11-24 22:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-24 18:16 [PATCH] send udev debug output to stdout instead of syslog Olaf Hering
2003-11-24 22:32 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).