2 * Define Message Types for Bacula
8 Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker
10 This program is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License as
12 published by the Free Software Foundation; either version 2 of
13 the License, or (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 General Public License for more details.
20 You should have received a copy of the GNU General Public
21 License along with this program; if not, write to the Free
22 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
43 * Most of these message levels are more or less obvious.
44 * They have evolved somewhat during the development of Bacula,
45 * and here are some of the details of where I am trying to
46 * head (in the process of changing the code) as of 15 June 2002.
48 * M_ABORT Bacula immediately aborts and tries to produce a traceback
49 * This is for really serious errors like segmentation fault.
50 * M_ERROR_TERM Bacula immediately terminates but no dump. This is for
51 * "obvious" serious errors like daemon already running or
52 * cannot open critical file, ... where a dump is not wanted.
53 * M_TERM Bacula daemon shutting down because of request (SIGTERM).
55 * The remaining apply to Jobs rather than the daemon.
57 * M_FATAL Bacula detected a fatal Job error. The Job will be killed,
58 * but Bacula continues running.
59 * M_ERROR Bacula detected a Job error. The Job will continue running
60 * but the termination status will be error.
61 * M_WARNING Job warning message.
62 * M_INFO Job information message.
64 * M_RESTORED An ls -l of each restored file.
66 * M_SECURITY For security viloations. This is equivalent to FATAL.
67 * (note, this is currently being implemented in 1.33).
69 * M_ALERT For Tape Alert messages.
74 /* Keep M_ABORT=1 for dlist.h */
75 M_ABORT = 1, /* MUST abort immediately */
76 M_DEBUG, /* debug message */
77 M_FATAL, /* Fatal error, stopping job */
78 M_ERROR, /* Error, but recoverable */
79 M_WARNING, /* Warning message */
80 M_INFO, /* Informational message */
81 M_SAVED, /* Info on saved file */
82 M_NOTSAVED, /* Info on notsaved file */
83 M_SKIPPED, /* File skipped during backup by option setting */
84 M_MOUNT, /* Mount requests */
85 M_ERROR_TERM, /* Error termination request (no dump) */
86 M_TERM, /* Terminating daemon normally */
87 M_RESTORED, /* ls -l of restored files */
88 M_SECURITY, /* security violation */
89 M_ALERT /* tape alert messages */
92 #define M_MAX M_ALERT /* keep this updated ! */
94 /* Define message destination structure */
95 /* *** FIXME **** where should be extended to handle multiple values */
96 typedef struct s_dest {
98 int dest_code; /* destination (one of the MD_ codes) */
99 int max_len; /* max mail line length */
100 FILE *fd; /* file descriptor */
101 char msg_types[nbytes_for_bits(M_MAX+1)]; /* message type mask */
102 char *where; /* filename/program name */
103 char *mail_cmd; /* mail command */
104 POOLMEM *mail_filename; /* unique mail filename */
107 /* Message Destination values for dest field of DEST */
108 #define MD_SYSLOG 1 /* send msg to syslog */
109 #define MD_MAIL 2 /* email group of messages */
110 #define MD_FILE 3 /* write messages to a file */
111 #define MD_APPEND 4 /* append messages to a file */
112 #define MD_STDOUT 5 /* print messages */
113 #define MD_STDERR 6 /* print messages to stderr */
114 #define MD_DIRECTOR 7 /* send message to the Director */
115 #define MD_OPERATOR 8 /* email a single message to the operator */
116 #define MD_CONSOLE 9 /* send msg to UserAgent or console */
117 #define MD_MAIL_ON_ERROR 10 /* email messages if job errors */
119 /* Queued message item */
128 void d_msg(const char *file, int line, int level, const char *fmt,...);
129 void e_msg(const char *file, int line, int type, int level, const char *fmt,...);
130 void Jmsg(JCR *jcr, int type, time_t mtime, const char *fmt,...);
132 extern int debug_level;
134 extern char my_name[];
135 extern const char *working_directory;
136 extern time_t daemon_start_time;
137 extern char catalog_db[];