Merge pull request #2330 from jwillemsen/jwi-stdminmax
[ACE_TAO.git] / ACE / apps / JAWS / clients / WebSTONE / src / nsapi-includes / base / ereport.h
blob2cd21b46ca659a9a371a73f2978584b440a1849d
1 /*
2 * Copyright (c) 1994, 1995. Netscape Communications Corporation. All
3 * rights reserved.
5 * Use of this software is governed by the terms of the license agreement for
6 * the Netscape Communications or Netscape Comemrce Server between the
7 * parties.
8 */
11 /* ------------------------------------------------------------------------ */
15 * ereport.h: Records transactions, reports errors to administrators, etc.
17 * Rob McCool
21 #ifndef EREPORT_H
22 #define EREPORT_H
25 #include "../base/session.h" /* Session structure */
26 #ifdef XP_UNIX
27 #include <pwd.h> /* struct passwd */
28 #endif /* XP_UNIX */
31 /* ------------------------------ Constants ------------------------------- */
35 * The maximum length of an error message. NOT RUN-TIME CHECKED
38 #define MAX_ERROR_LEN 8192
40 /* A warning is a minor mishap, such as a 404 being issued. */
41 #define LOG_WARN 0
44 * A misconfig is when there is a syntax error or permission violation in
45 * a config. file.
47 #define LOG_MISCONFIG 1
50 * Security warnings are issued when authentication fails, or a host is
51 * given a 403 return code.
53 #define LOG_SECURITY 2
56 * A failure is when a request could not be fulfilled due to an internal
57 * problem, such as a CGI script exiting prematurely, or a filesystem
58 * permissions problem.
60 #define LOG_FAILURE 3
63 * A catastrophe is a fatal server error such as running out of
64 * memory or processes, or a system call failing, or even a server crash.
65 * The server child cannot recover from a catastrophe.
67 #define LOG_CATASTROPHE 4
70 * Informational message, of no concern.
72 #define LOG_INFORM 5
75 * The time format to use in the error log
78 #define ERR_TIMEFMT "[%d/%b/%Y:%H:%M:%S]"
81 /* The fd you will get if you are reporting errors to SYSLOG */
83 #define ERRORS_TO_SYSLOG -1
86 /* ------------------------------ Prototypes ------------------------------ */
90 * ereport logs an error of the given degree and formats the arguments with
91 * the printf() style fmt. Returns whether the log was successful. Records
92 * the current date.
95 int ereport(int degree, char *fmt, ...);
98 * ereport_init initializes the error logging subsystem and opens the static
99 * file descriptors. It returns NULL upon success and an error string upon
100 * error. If a userpw is given, the logs will be chowned to that user.
102 * email is the address of a person to mail upon catastrophic error. It
103 * can be NULL if no e-mail is desired. ereport_init will not duplicate
104 * its own copy of this string; you must make sure it stays around and free
105 * it when you shut down the server.
108 char *ereport_init(char *err_fn, char *email, struct passwd *pw);
111 * log_terminate closes the error and common log file descriptors.
113 void ereport_terminate();
115 /* For restarts */
116 SYS_FILE ereport_getfd();
118 #endif