-const char errlog_rcs[] = "$Id: errlog.c,v 1.50 2007/04/11 10:55:44 fabiankeil Exp $";
+const char errlog_rcs[] = "$Id: errlog.c,v 1.51 2007/05/11 11:51:34 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/errlog.c,v $
*
* Revisions :
* $Log: errlog.c,v $
+ * Revision 1.51 2007/05/11 11:51:34 fabiankeil
+ * Fix a type mismatch warning.
+ *
* Revision 1.50 2007/04/11 10:55:44 fabiankeil
* Enforce some assertions that could be triggered
* on mingw32 and other systems where we use threads
#endif /* defined(USE_NEW_LOG_ERROR) */
+/*********************************************************************
+ *
+ * Function : jb_err_to_string
+ *
+ * Description : Translates JB_ERR_FOO codes into strings.
+ *
+ * XXX: the type of error codes is jb_err
+ * but the typedef'inition is currently not
+ * visible to all files that include errlog.h.
+ *
+ * Parameters :
+ * 1 : error = a valid jb_err code
+ *
+ * Returns : A string with the jb_err translation
+ *
+ *********************************************************************/
+const char *jb_err_to_string(int error)
+{
+ switch (error)
+ {
+ case JB_ERR_OK:
+ return "Success, no error";
+ case JB_ERR_MEMORY:
+ return "Out of memory";
+ case JB_ERR_CGI_PARAMS:
+ return "Missing or corrupt CGI parameters";
+ case JB_ERR_FILE:
+ return "Error opening, reading or writing a file";
+ case JB_ERR_PARSE:
+ return "Parse error";
+ case JB_ERR_MODIFIED:
+ return "File has been modified outside of the CGI actions editor.";
+ case JB_ERR_COMPRESS:
+ return "(De)compression failure";
+ default:
+ assert(0);
+ return "Unknown error";
+ }
+ assert(0);
+ return "Internal error";
+}
+
#ifdef _WIN32
/*********************************************************************
*
#ifndef ERRLOG_H_INCLUDED
#define ERRLOG_H_INCLUDED
-#define ERRLOG_H_VERSION "$Id: errlog.h,v 1.16 2006/11/28 15:29:50 fabiankeil Exp $"
+#define ERRLOG_H_VERSION "$Id: errlog.h,v 1.17 2007/03/31 13:33:28 fabiankeil Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/errlog.h,v $
*
* Revisions :
* $Log: errlog.h,v $
+ * Revision 1.17 2007/03/31 13:33:28 fabiankeil
+ * Add alternative log_error() with timestamps
+ * that contain milliseconds and without using
+ * strcpy(), strcat() or sprintf().
+ *
* Revision 1.16 2006/11/28 15:29:50 fabiankeil
* Define LOG_LEVEL_REDIRECTS independently of
* FEATURE_FAST_REDIRECTS. It is used by redirect{}
extern void init_error_log(const char *prog_name, const char *logfname, int debuglevel);
extern void log_error(int loglevel, const char *fmt, ...);
+extern const char *jb_err_to_string(int error);
/* Revision control strings from this header and associated .c file */
extern const char errlog_rcs[];