|
@@ -63,8 +63,8 @@
|
63
|
63
|
#define PYFCGI_LOG_DTM_LEN 25
|
64
|
64
|
#define PYFCGI_LOG_LVL_LEN 7
|
65
|
65
|
#define PYFCGI_LOG_TYP_LEN 7
|
66
|
|
-#define PYFCGI_LOG_PID_LEN 4
|
67
|
|
-#define PYFCGI_LOG_PID_FMT "%04d"
|
|
66
|
+#define PYFCGI_LOG_PID_LEN 6
|
|
67
|
+#define PYFCGI_LOG_PID_FMT "%6d"
|
68
|
68
|
|
69
|
69
|
#define SYSLOG_syslog syslog
|
70
|
70
|
#define SYSLOG_vsyslog vsyslog
|
|
@@ -98,7 +98,7 @@
|
98
|
98
|
#define LOG_DEBUG (8 << 4)
|
99
|
99
|
|
100
|
100
|
/**@brief Convert a PyFCGI loglevel in a syslog one */
|
101
|
|
-#define PYFCGI_SYSLOG_LVL(lvl) (SYSLOG_LVLS[(lvl & 0xF0) >> 4])
|
|
101
|
+#define PYFCGI_SYSLOG_LVL(lvl) (((lvl & 0xF0) >> 4)-1)
|
102
|
102
|
|
103
|
103
|
/**@brief Macro checking if syslog is activated and log a message
|
104
|
104
|
* @params int lvl the PyFCGI log level
|
|
@@ -125,13 +125,15 @@
|
125
|
125
|
/**@ingroup cong_logger_flags */
|
126
|
126
|
#define PYFCGI_LOG_FSYSLOG 1
|
127
|
127
|
/**@brief Indicate if the logger should try to reopen on failure
|
|
128
|
+ * @warn not implemented
|
128
|
129
|
* @ingroup cong_logger_flags */
|
129
|
130
|
#define PYFCGI_LOG_FRETRY 2
|
130
|
131
|
/**@brief Exit if failure
|
|
132
|
+ * @warn not implemented
|
131
|
133
|
* @ingroup cong_logger_flags */
|
132
|
134
|
#define PYFCGI_LOG_FEXIT_ONFAIL 4
|
133
|
135
|
|
134
|
|
-#define PYFCGI_LOGGER_FMT_DEFAULT "{datetime} {ident} {level}({pid}) {msg}"
|
|
136
|
+#define PYFCGI_LOGGER_FMT_DEFAULT "{datetime} {ident}[{pid}] {level} {msg}"
|
135
|
137
|
#define PYFCGI_LOGGER_TIME_FMT_DEFAULT "%F %T%z"
|
136
|
138
|
|
137
|
139
|
|
|
@@ -151,9 +153,7 @@ typedef struct ident_args_s ident_args_t;
|
151
|
153
|
typedef union pyfcgi_logger_field_args pyfcgi_logger_field_args_u;
|
152
|
154
|
|
153
|
155
|
|
154
|
|
-static const short SYSLOG_LVLS[8] = {LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR,
|
155
|
|
- LOG_WARNING, LOG_NOTICE, LOG_INFO, LOG_DEBUG};
|
156
|
|
-static const char* PYFCGI_LOGGER_LVLNAME[] = {
|
|
156
|
+static const char* PYFCGI_LOGGER_LVLNAME[] __attribute__((unused)) = {
|
157
|
157
|
" Emerge",
|
158
|
158
|
" Alert",
|
159
|
159
|
" Critic",
|
|
@@ -163,8 +163,8 @@ static const char* PYFCGI_LOGGER_LVLNAME[] = {
|
163
|
163
|
" Info",
|
164
|
164
|
" Debug"};
|
165
|
165
|
|
166
|
|
-static const char* PYFCGI_LOGGER_TYPNAME[] = {"Global", "Access", "Internal",
|
167
|
|
- "Worker", "Master"};
|
|
166
|
+static const char* PYFCGI_LOGGER_TYPNAME[] __attribute__((unused)) =
|
|
167
|
+ {"Global", "Access", "Internal", "Worker", "Master"} ;
|
168
|
168
|
|
169
|
169
|
|
170
|
170
|
/**@defgroup conf_logger_format Logline format
|
|
@@ -321,6 +321,11 @@ int pyfcgi_logger_init();
|
321
|
321
|
*/
|
322
|
322
|
int pyfcgi_logger_stop();
|
323
|
323
|
|
|
324
|
+/**@brief Enable syslog logging with given ident
|
|
325
|
+ * @param char* ident if NULL use current ident
|
|
326
|
+ */
|
|
327
|
+void pyfcgi_logger_enable_syslog(char*);
|
|
328
|
+
|
324
|
329
|
/**@brief Stop & free an individual logger */
|
325
|
330
|
void _pyfcgi_logger_free(pyfcgi_logger_t*);
|
326
|
331
|
|