Skip to contentSkip to conversation

logging refactoring

PATCH Superseded Colin McCabe 3 participants 16 messages Dec 9, 2009 – Dec 15, 2009 Library code

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover logging refactoring

This patch series creates a common.h and populates it with some function prototypes and logging stuff.

version 2:
* Rename CLD_DEBUG, etc. to HAIL_DEBUG
* use angle brackets for including common.h from include/

Colin McCabe (6):
cld: Declare common.c functions in common.h
cld: create logging macros
cld: modify client code to use logging macros
cld: modify server code to use logging macros
cld: modify cld-dns to use logging macros
cld: Tweak some log levels in cldc dns

 include/cld_msg.h |   10 -----
 include/cldc.h    |   12 +++----
 include/common.h  |   38 ++++++++++++++++++++
 lib/cldc-dns.c    |   82 +++++++++++++++++---------------------------
 lib/cldc.c        |   98 +++++++++++++++++++++-------------------------------
 server/cld.h      |    4 +-
 server/cldb.c     |    6 ++--
 server/msg.c      |   49 +++++++++++---------------
 server/server.c   |   86 ++++++++++++++++++++--------------------------
 server/session.c  |   57 ++++++++++++-------------------
 server/util.c     |   27 +++++++-------
 tools/cldcli.c    |   14 +++++---
 12 files changed, 223 insertions(+), 260 deletions(-)
 create mode 100644 include/common.h
#1 lore raw

PATCH v2 1/6 cld: Declare common.c functions in common.h

---
 include/cld_msg.h |   10 ----------
 include/cldc.h    |    1 +
 include/common.h  |   11 +++++++++++
 3 files changed, 12 insertions(+), 10 deletions(-)
 create mode 100644 include/common.h
include/cld_msg.h +0 -10
index 641b857..01837b7 100644
@@ -250,14 +250,4 @@ struct cld_msg_event {
 	uint8_t			res[4];
 };
 
-/*
- * function prototypes for lib/common.c;
- * ideally these should not be in cld_msg.h
- */
-
-extern unsigned long long cld_sid2llu(const uint8_t *sid);
-extern void __cld_rand64(void *p);
-extern const char *cld_errstr(enum cle_err_codes ecode);
-extern int cld_readport(const char *fname);
-
 #endif /* __CLD_MSG_H__ */
include/cldc.h +1 -0
index 9ae6dfe..3f0deb5 100644
@@ -5,6 +5,7 @@
 #include <stdbool.h>
 #include <glib.h>
 #include <cld_msg.h>
+#include <common.h>
 
 struct cldc_session;
 
include/common.h new file +11 -0
new file mode 100644
index 0000000..52e5603
@@ -0,0 +1,11 @@
+#ifndef __CLD_COMMON_H__
+#define __CLD_COMMON_H__
+
+#include <stdint.h>
+
+unsigned long long cld_sid2llu(const uint8_t *sid);
+void __cld_rand64(void *p);
+const char *cld_errstr(enum cle_err_codes ecode);
+int cld_readport(const char *fname);
+
+#endif /* __CLD_COMMON_H__ */
Signature · 1 line
1.6.2.5
#2 lore raw

PATCH v2 2/6 cld: create logging macros

In reply to Colin McCabe
---
 include/common.h |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)
include/common.h +27 -0
index 52e5603..f6ad4f6 100644
@@ -8,4 +8,31 @@ void __cld_rand64(void *p);
 const char *cld_errstr(enum cle_err_codes ecode);
 int cld_readport(const char *fname);
 
+/** Print out a debug message if 'verbose' is enabled */
+#define HAIL_DEBUG(log, ...) \
+	if ((log)->verbose) { \
+		(log)->func(LOG_DEBUG, __VA_ARGS__); \
+	}
+
+/** Print out an informational log message */
+#define HAIL_INFO(log, ...) \
+	(log)->func(LOG_INFO, __VA_ARGS__);
+
+/** Print out a warning message */
+#define HAIL_WARN(log, ...) \
+	(log)->func(LOG_WARNING, __VA_ARGS__);
+
+/** Print out an error message */
+#define HAIL_ERR(log, ...) \
+	(log)->func(LOG_ERR, __VA_ARGS__);
+
+/** Print out a critical warning message */
+#define HAIL_CRIT(log, ...) \
+	(log)->func(LOG_CRIT, __VA_ARGS__);
+
+struct hail_log {
+	void (*func)(int prio, const char *fmt, ...);
+	bool verbose;
+};
+
 #endif /* __CLD_COMMON_H__ */
Signature · 1 line
1.6.2.5
#3 lore raw

PATCH v2 3/6 cld: modify client code to use logging macros

In reply to Colin McCabe
---
 include/cldc.h |    4 +--
 lib/cldc.c     |   98 +++++++++++++++++++++++---------------------------------
 tools/cldcli.c |    2 +-
 3 files changed, 42 insertions(+), 62 deletions(-)
include/cldc.h +1 -3
index 3f0deb5..584e026 100644
@@ -85,10 +85,8 @@ struct cldc_ops {
 struct cldc_session {
 	uint8_t		sid[CLD_SID_SZ];	/* client id */
 
-	bool		verbose;
-
 	const struct cldc_ops *ops;
-	void		(*act_log)(int prio, const char *fmt, ...);
+	struct		hail_log log;
 	void		*private;
 
 	uint8_t		addr[64];		/* server address */
lib/cldc.c +40 -58

237 lines not on this page · raw message

tools/cldcli.c +1 -1
index 60ab301..23cba99 100644
@@ -823,7 +823,7 @@ static gpointer cld_thread(gpointer dummy)
 		return NULL;
 	}
 
-	thr_udp->sess->verbose = cldcli_verbose;
+	thr_udp->sess->log.verbose = cldcli_verbose;
 
 	pfd[0].fd = thr_udp->fd;
 	pfd[0].events = POLLIN;
Signature · 1 line
1.6.2.5
#4 lore raw

PATCH v2 4/6 cld: modify server code to use logging macros

In reply to Colin McCabe
---
 server/cld.h     |    4 +-
 server/cldb.c    |    6 ++--
 server/msg.c     |   49 +++++++++++++-----------------
 server/server.c  |   86 ++++++++++++++++++++++++------------------------------
 server/session.c |   57 ++++++++++++++----------------------
 server/util.c    |   27 +++++++++--------
 6 files changed, 100 insertions(+), 129 deletions(-)
server/cld.h +2 -2
index 05c93ad..efe7ee4 100644
@@ -26,6 +26,7 @@
 #include <glib.h>
 #include "cldb.h"
 #include <cld_msg.h>
+#include <common.h>
 #include <libtimer.h>
 
 struct client;
@@ -152,7 +153,7 @@ extern int sess_load(GHashTable *ss);
 /* server.c */
 extern const char *opstr(enum cld_msg_ops op);
 extern struct server cld_srv;
-extern int debugging;
+extern struct hail_log srv_log;
 extern struct timeval current_time;
 extern int udp_tx(int sock_fd, struct sockaddr *, socklen_t,
 	    const void *, size_t);
@@ -161,7 +162,6 @@ extern void resp_err(struct session *sess,
 	      const struct cld_msg_hdr *src, enum cle_err_codes errcode);
 extern void resp_ok(struct session *sess, const struct cld_msg_hdr *src);
 extern bool authsign(struct cld_packet *pkt, size_t pkt_len);
-extern void applog(int prio, const char *fmt, ...);
 
 /* util.c */
 extern int write_pid_file(const char *pid_fn);
server/cldb.c +3 -3
index 2f012e5..a0d3a67 100644
@@ -241,7 +241,7 @@ int cldb_init(struct cldb *cldb, const char *db_home, const char *db_password,
 
 	rc = db_env_create(&cldb->env, 0);
 	if (rc) {
-		applog(LOG_WARNING, "cldb->env_create failed: %d", rc);
+		HAIL_WARN(&srv_log, "cldb->env_create failed: %d", rc);
 		return rc;
 	}
 
@@ -375,7 +375,7 @@ static int cldb_up(struct cldb *cldb, unsigned int flags)
 
 	cldb->up = true;
 
-	applog(LOG_INFO, "databases up");
+	HAIL_INFO(&srv_log, "databases up");
 	return 0;
 
 err_out_handle_idx:
@@ -417,7 +417,7 @@ void cldb_down(struct cldb *cldb)
 	cldb->inodes = NULL;
 	cldb->sessions = NULL;
 
-	applog(LOG_INFO, "databases down");
+	HAIL_INFO(&srv_log, "databases down");
 }
 
 void cldb_fini(struct cldb *cldb)
server/msg.c +21 -28

113 lines not on this page · raw message

server/server.c +38 -48

199 lines not on this page · raw message

server/session.c +22 -35

121 lines not on this page · raw message

server/util.c +14 -13
index 36fa219..9ca53a9 100644
@@ -47,8 +47,9 @@ int write_pid_file(const char *pid_fn)
 	fd = open(pid_fn, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
 	if (fd < 0) {
 		err = errno;
-		applog(LOG_ERR, "Cannot open PID file %s: %s",
-		       pid_fn, strerror(err));
+
+		HAIL_ERR(&srv_log, "Cannot open PID file %s: %s",
+			pid_fn, strerror(err));
 		return -err;
 	}
 
@@ -59,11 +60,11 @@ int write_pid_file(const char *pid_fn)
 	if (fcntl(fd, F_SETLK, &lock) != 0) {
 		err = errno;
 		if (err == EAGAIN) {
-			applog(LOG_ERR, "PID file %s is already locked",
-			       pid_fn);
+			HAIL_ERR(&srv_log, "PID file %s is already locked",
+				pid_fn);
 		} else {
-			applog(LOG_ERR, "Cannot lock PID file %s: %s",
-			       pid_fn, strerror(err));
+			HAIL_ERR(&srv_log, "Cannot lock PID file %s: %s",
+				pid_fn, strerror(err));
 		}
 		close(fd);
 		return -err;
@@ -76,8 +77,8 @@ int write_pid_file(const char *pid_fn)
 		ssize_t rc = write(fd, s, bytes);
 		if (rc < 0) {
 			err = errno;
-			applog(LOG_ERR, "PID number write failed: %s",
-			       strerror(err));
+			HAIL_ERR(&srv_log, "PID number write failed: %s",
+				strerror(err));
 			goto err_out;
 		}
 
@@ -88,7 +89,7 @@ int write_pid_file(const char *pid_fn)
 	/* make sure file data is written to disk */
 	if (fsync(fd) < 0) {
 		err = errno;
-		applog(LOG_ERR, "PID file fsync failed: %s", strerror(err));
+		HAIL_ERR(&srv_log, "PID file fsync failed: %s", strerror(err));
 		goto err_out;
 	}
 
@@ -102,7 +103,7 @@ err_out:
 
 void syslogerr(const char *prefix)
 {
-	applog(LOG_ERR, "%s: %s", prefix, strerror(errno));
+	HAIL_ERR(&srv_log, "%s: %s", prefix, strerror(errno));
 }
 
 int fsetflags(const char *prefix, int fd, int or_flags)
@@ -112,7 +113,7 @@ int fsetflags(const char *prefix, int fd, int or_flags)
 	/* get current flags */
 	old_flags = fcntl(fd, F_GETFL);
 	if (old_flags < 0) {
-		applog(LOG_ERR, "%s F_GETFL: %s", prefix, strerror(errno));
+		HAIL_ERR(&srv_log, "%s F_GETFL: %s", prefix, strerror(errno));
 		return -errno;
 	}
 
@@ -123,8 +124,8 @@ int fsetflags(const char *prefix, int fd, int or_flags)
 	/* set new flags */
 	if (flags != old_flags)
 		if (fcntl(fd, F_SETFL, flags) < 0) {
-			applog(LOG_ERR, "%s F_SETFL: %s", prefix,
-			       strerror(errno));
+			HAIL_ERR(&srv_log, "%s F_SETFL: %s", prefix,
+				strerror(errno));
 			rc = -errno;
 		}
 
Signature · 1 line
1.6.2.5
#5 lore raw

PATCH v2 5/6 cld: modify cld-dns to use logging macros

In reply to Colin McCabe
---
 include/cldc.h |    7 ++---
 lib/cldc-dns.c |   80 +++++++++++++++++++++-----------------------------------
 tools/cldcli.c |   12 +++++---
 3 files changed, 41 insertions(+), 58 deletions(-)
include/cldc.h +3 -4
index 584e026..abec747 100644
@@ -200,14 +200,13 @@ extern int cldc_udp_pkt_send(void *private,
 			  const void *buf, size_t buflen);
 
 /* cldc-dns */
-extern int cldc_getaddr(GList **host_list, const char *thishost, bool verbose,
-		 void (*act_log)(int prio, const char *fmt, ...));
+extern int cldc_getaddr(GList **host_list, const char *thishost,
+			struct hail_log *log);
 extern int cldc_saveaddr(struct cldc_host *hp,
 			 unsigned int priority,
 			 unsigned int weight, unsigned int port,
 			 unsigned int nlen, const char *name,
-			 bool verbose,
-			 void (*act_log)(int prio, const char *fmt, ...));
+			 struct hail_log *log);
 
 static inline bool seqid_after_eq(uint64_t a_, uint64_t b_)
 {
lib/cldc-dns.c +30 -50

190 lines not on this page · raw message

tools/cldcli.c +8 -4
index 23cba99..8eeee72 100644
@@ -97,7 +97,6 @@ struct timer {
 };
 
 static unsigned long thread_running = 1;
-static int debugging;
 static GList *host_list;
 static char clicwd[CLD_PATH_MAX + 1] = "/";
 static int to_thread[2], from_thread[2];
@@ -136,6 +135,11 @@ static void applog(int prio, const char *fmt, ...)
 	va_end(ap);
 }
 
+static struct hail_log cli_log = {
+	.func = applog,
+	.verbose = 0,
+};
+
 static gint timer_cmp(gconstpointer a_, gconstpointer b_)
 {
 	const struct timer *a = a_;
@@ -531,7 +535,7 @@ static void handle_user_command(void)
 
 	read_to_thread(&creq, sizeof(creq));
 
-	if (debugging)
+	if (cli_log.verbose)
 		switch (creq.cmd) {
 		case CREQ_CD:
 		case CREQ_CAT:
@@ -1236,7 +1240,7 @@ static error_t parse_opt (int key, char *arg, struct argp_state *state)
 	switch(key) {
 	case 'D':
 		if (atoi(arg) >= 0 && atoi(arg) <= 2)
-			debugging = atoi(arg);
+			cli_log.verbose = atoi(arg);
 		else {
 			fprintf(stderr, "invalid debug level: '%s'\n", arg);
 			argp_usage(state);
@@ -1304,7 +1308,7 @@ int main (int argc, char *argv[])
 			return 1;
 		}
 		hostb[hostsz-1] = 0;
-		if (cldc_getaddr(&host_list, hostb, debugging, applog)) {
+		if (cldc_getaddr(&host_list, hostb, &cli_log)) {
 			fprintf(stderr, "Unable to find a CLD host\n");
 			return 1;
 		}
Signature · 1 line
1.6.2.5
#6 lore raw

Re: [PATCH 5/6] cld: modify cld-dns to use logging macros

lib/cldc-dns.c static void push_host(GList **host_list, struct cldc_host *hp_in) · line 158

Quoted 9 lines · On Tue, 8 Dec 2009 16:11:55 -0800 Colin McCabe <[email protected]> wrote:
lib/cldc-dns.c +2 -2
@@ -161,8 +153,8 @@ static void push_host(GList **host_list, struct cldc_host *hp_in)
  * This is not reentrant.  Better be called before any other threads
  * are started.
  */
-int cldc_getaddr(GList **host_list, const char *thishost, bool verbose,
-		 void (*act_log)(int prio, const char *fmt, ...))
+int cldc_getaddr(GList **host_list, const char *thishost,
+		struct hail_log *log)
 {

Nothing about the change as such, but you are going to change users of these public interfaces too, right? I mean Chunk and tabled.

-- Pete

#7 lore raw

Re: [PATCH 5/6] cld: modify cld-dns to use logging macros

Quoted 16 lines · Pete Zaitcev

lib/cldc-dns.c static void push_host(GList **host_list, struct cldc_host *hp_in) · line 158

Quoted 9 lines · On Tue,  8 Dec 2009 16:11:55 -0800 Colin McCabe <[email protected]> wrote:
lib/cldc-dns.c +2 -2
@@ -161,8 +153,8 @@ static void push_host(GList **host_list, struct cldc_host *hp_in)
   * This is not reentrant.  Better be called before any other threads
   * are started.
   */
-int cldc_getaddr(GList **host_list, const char *thishost, bool verbose,
-              void (*act_log)(int prio, const char *fmt, ...))
+int cldc_getaddr(GList **host_list, const char *thishost,
+             struct hail_log *log)
  {

Nothing about the change as such, but you are going to change users of these public interfaces too, right? I mean Chunk and tabled.

Quoted 2 lines

-- Pete

d'oh! That's what I get for only running the cld tests. I guess I should run some chunkd and tabled tests from time to time.

Colin

#8 lore raw

PATCH v2 6/6 cld: Tweak some log levels in cldc dns

In reply to Colin McCabe
---
 lib/cldc-dns.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
lib/cldc-dns.c +5 -5
index d58a8ba..1bf6355 100644
@@ -46,7 +46,7 @@ int cldc_saveaddr(struct cldc_host *hp,
 
 	rc = getaddrinfo(hostname, portstr, &hints, &res0);
 	if (rc) {
-		HAIL_INFO(log, "getaddrinfo(%s,%s) failed: %s",
+		HAIL_ERR(log, "getaddrinfo(%s,%s) failed: %s",
 		       hostname, portstr, gai_strerror(rc));
 		rc = -EINVAL;
 		goto err_addr;
@@ -65,7 +65,7 @@ int cldc_saveaddr(struct cldc_host *hp,
 	}
 
 	if (!something_suitable) {
-		HAIL_INFO(log, "Host %s port %u has no addresses",
+		HAIL_ERR(log, "Host %s port %u has no addresses",
 		       hostname, port);
 		rc = -EINVAL;
 		goto err_suitable;
@@ -195,8 +195,8 @@ do_try_again:
 			/* fall through */
 		case NO_RECOVERY:
 		default:
-			HAIL_INFO(log, "cldc_getaddr: res_search error (%d): %s",
-				h_errno, hstrerror(h_errno));
+			HAIL_ERR(log, "cldc_getaddr: res_search error "
+				"(%d): %s", h_errno, hstrerror(h_errno));
 			return -1;
 		}
 	}
@@ -209,7 +209,7 @@ do_try_again:
 	}
 
 	if (ns_initparse(resp, rlen, &nsb) < 0) {
-		HAIL_INFO(log, "cldc_getaddr: ns_initparse error");
+		HAIL_ERR(log, "cldc_getaddr: ns_initparse error");
 		return -1;
 	}
 
Signature · 1 line
1.6.2.5
#9 lore raw
In reply to Colin McCabe

Hi all,

I think I'm going to respin this patch to be a lot smaller. Just refactor one or two things, but leave the existing "verbose" and "applog" system in place. Let me know what you think-- do you think I should push ahead with HAIL_DEBUG etc.,

cheers.
Colin

Quoted 31 lines · Colin McCabe

This patch series creates a common.h and populates it with some function prototypes and logging stuff.

version 2:
* Rename CLD_DEBUG, etc. to HAIL_DEBUG
* use angle brackets for including common.h from include/

Colin McCabe (6):
cld: Declare common.c functions in common.h
cld: create logging macros
cld: modify client code to use logging macros
cld: modify server code to use logging macros
cld: modify cld-dns to use logging macros
cld: Tweak some log levels in cldc dns

 include/cld_msg.h |   10 -----
 include/cldc.h    |   12 +++----
 include/common.h  |   38 ++++++++++++++++++++
 lib/cldc-dns.c    |   82 +++++++++++++++++---------------------------
 lib/cldc.c        |   98 +++++++++++++++++++++-------------------------------
 server/cld.h      |    4 +-
 server/cldb.c     |    6 ++--
 server/msg.c      |   49 +++++++++++---------------
 server/server.c   |   86 ++++++++++++++++++++--------------------------
 server/session.c  |   57 ++++++++++++-------------------
 server/util.c     |   27 +++++++-------
 tools/cldcli.c    |   14 +++++---
 12 files changed, 223 insertions(+), 260 deletions(-)
 create mode 100644 include/common.h
#10 lore raw
Quoted 6 lines · Colin McCabe

Hi all,

I think I'm going to respin this patch to be a lot smaller. Just refactor one or two things, but leave the existing "verbose" and "applog" system in place. Let me know what you think-- do you think I should push ahead with HAIL_DEBUG etc.,

Well... I was waiting until today to see if downstream API-related patches would appear. Prior to CLD version 1.0, the "rules" are that any and all network protocol or client API changes are OK. After 1.0, we will need to take typical userland library precautions to properly version API changes, avoid breakage, etc.

However, even prior to v1.0, API changes do introduce breakage in chunkd and tabled. Typically, if you make a client API change, patches to update the other projects should be provided as well.

So I was leaning towards applying and then fixing up chunkd/tabled myself, but any proposed alternative described as "just refactor a thing or two" is certainly very appealing :)

It's up to you...

Jeff

#11 lore raw
Quoted 15 lines · Jeff Garzik
Quoted 7 lines · Colin McCabe

Hi all,

I think I'm going to respin this patch to be a lot smaller. Just refactor one or two things, but leave the existing "verbose" and "applog" system in place. Let me know what you think-- do you think I should push ahead with HAIL_DEBUG etc.,

Well...   I was waiting until today to see if downstream API-related patches would appear.  Prior to CLD version 1.0, the "rules" are that any and all network protocol or client API changes are OK.  After 1.0, we will need to take typical userland library precautions to properly version API changes, avoid breakage, etc.

Quoted 7 lines

However, even prior to v1.0, API changes do introduce breakage in chunkd and tabled.  Typically, if you make a client API change, patches to update the other projects should be provided as well.

So I was leaning towards applying and then fixing up chunkd/tabled myself, but any proposed alternative described as "just refactor a thing or two" is certainly very appealing :)

I have some patches to get chunkd and tabled compiling, but I'd need to run them through some minimal testing.

Also my new patch creates a hail_log.h. It didn't really seem right to force everyone who wanted to use HAIL_LOG to include cldc.h.

I'll convert over the rest of chunkd and tabled to the new macros if this patch series gets accepted (but not in this patch series!)

Quoted 3 lines

It's up to you...

Logic says I shouldn't waste time repainting the logging bike shed. But then I see a two-line comment turn into five lines because of indentation, and I just want to put a new coat of paint on that thing.

Anyway, I'll post the patches for the full thing in a bit.

Colin

#12 lore raw
Quoted 5 lines · On Mon, 14 Dec 2009 18:18:47 -0800 Colin McCabe <[email protected]> wrote:

Also my new patch creates a hail_log.h. It didn't really seem right to force everyone who wanted to use HAIL_LOG to include cldc.h.

I'll convert over the rest of chunkd and tabled to the new macros if this patch series gets accepted (but not in this patch series!)

You know what else would be nice? I find it irritating to include <syslog.h> everywhere due to 1:1 mapping of LOG_XXX values. I'm inclined to think that a switch(){} in applog() would be an acceptable price for getting rid of it.

In fact, does anyone even understand why we continue to split LOG_WARNING and LOG_ERR? We really have three log levels:
- debug
- info (which is actually an error)
- error (not really all that different from info actually)
Might as well create HAIL_DEBUG, HAIL_INFO, and HAIL_ERR (to be used before exit(1), with values of 0,1,2 and remap to syslog values where it goes to syslog.

-- Pete

#13 lore raw
Quoted 14 lines · Pete Zaitcev
Quoted 5 lines · On Mon, 14 Dec 2009 18:18:47 -0800 Colin McCabe<[email protected]> wrote:

Also my new patch creates a hail_log.h. It didn't really seem right to force everyone who wanted to use HAIL_LOG to include cldc.h.

I'll convert over the rest of chunkd and tabled to the new macros if this patch series gets accepted (but not in this patch series!)

You know what else would be nice? I find it irritating to include <syslog.h> everywhere due to 1:1 mapping of LOG_XXX values. I'm inclined to think that a switch(){} in applog() would be an acceptable price for getting rid of it.

Quoted 8 lines

In fact, does anyone even understand why we continue to split LOG_WARNING and LOG_ERR? We really have three log levels:
- debug
- info (which is actually an error)
- error (not really all that different from info actually)
Might as well create HAIL_DEBUG, HAIL_INFO, and HAIL_ERR (to be used before exit(1), with values of 0,1,2 and remap to syslog values where it goes to syslog.

It would be nice to disconnect from syslog, yes. But the 'warning' log level has value.

Jeff

#14 lore raw
Quoted 11 lines · On Tue, 15 Dec 2009 17:38:18 -0500 Jeff Garzik <[email protected]> wrote:
Quoted 8 lines

In fact, does anyone even understand why we continue to split LOG_WARNING and LOG_ERR? We really have three log levels:
- debug
- info (which is actually an error)
- error (not really all that different from info actually)
Might as well create HAIL_DEBUG, HAIL_INFO, and HAIL_ERR (to be used before exit(1), with values of 0,1,2 and remap to syslog values where it goes to syslog.

It would be nice to disconnect from syslog, yes. But the 'warning' log level has value.

Can you offer any guidelines that are easy to follow and enforce? I am often confused and select the level randomly. The only rule I follow is: if and only if it's under if (debugging), then LOG_DEBUG. Otherwise... hmm...

-- Pete

#15 lore raw
Quoted 12 lines · Pete Zaitcev
Quoted 9 lines · On Tue, 15 Dec 2009 17:38:18 -0500 Jeff Garzik<[email protected]> wrote:
Quoted 8 lines

In fact, does anyone even understand why we continue to split LOG_WARNING and LOG_ERR? We really have three log levels:
- debug
- info (which is actually an error)
- error (not really all that different from info actually)
Might as well create HAIL_DEBUG, HAIL_INFO, and HAIL_ERR (to be used before exit(1), with values of 0,1,2 and remap to syslog values where it goes to syslog.

Quoted 7 lines
Quoted 2 lines

It would be nice to disconnect from syslog, yes. But the 'warning' log level has value.

Can you offer any guidelines that are easy to follow and enforce? I am often confused and select the level randomly. The only rule I follow is: if and only if it's under if (debugging), then LOG_DEBUG. Otherwise... hmm...

Sure, man 3 syslog :)

Err - error message, that will probably kill the server. Warn - warning message - bad, but not fatal to the server info - information message, like startup messages debug - debugging messages, of interest mainly to programmers

Jeff