[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [master] logging: turn the loglevels into proper enum.



-#define DEBUGLVL 10
-#define INFO     20
-#define WARNING  30
-#define ERROR    40
-#define CRITICAL 50
+enum loglevel_t {
+    DEBUGLVL,
+    INFO,
+    WARNING,
+    ERROR,
+    CRITICAL
+};

I realize you were probably just following the (bad) example below, but
you should really do this as:

typedef enum {
...
} loglevel_t;

and then all those callers above can be "loglevel_t level" instead of
"enum loglevel_t level".  Also naming things _t without them being
typedef's is a sin.

  enum logger_t {
      MAIN_LOG = 1,
      PROGRAM_LOG = 2
  };

--
        Peter

Space, is big. Really big. You just won't believe how vastly hugely
mindbogglingly big it is. I mean you may think it's a long way down the
road to the chemist, but that's just peanuts to space.
		-- The Hitchhiker's Guide to the Galaxy

01234567890123456789012345678901234567890123456789012345678901234567890123456789


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]