]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/lib/message.h
First cut 1.23 -- kes07Jul02
[bacula/bacula] / bacula / src / lib / message.h
1 /*
2  * Define Message Types for Bacula
3  *    Kern Sibbald, 2000
4  *
5  *   Version $Id$
6  */
7 /*
8    Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker
9
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.
14
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.
19
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,
23    MA 02111-1307, USA.
24
25  */
26
27 #include "bits.h"
28
29 #undef  M_DEBUG
30 #undef  M_ABORT
31 #undef  M_FATAL
32 #undef  M_ERROR
33 #undef  M_WARNING
34 #undef  M_INFO
35 #undef  M_MOUNT
36 #undef  M_ERROR_TERM
37 #undef  M_TERM
38
39 /*
40  * Most of these message levels are more or less obvious. 
41  * They have evolved somewhat during the development of Bacula,
42  * and here are some of the details of where I am trying to
43  * head (in the process of changing the code) as of 15 June 2002.
44  *
45  *  M_ABORT       Bacula immediately aborts and tries to produce a traceback
46  *                  This is for really serious errors like segmentation fault.
47  *  M_ERROR_TERM  Bacula immediately terminates but no dump. This is for
48  *                  "obvious" serious errors like daemon already running or
49  *                   cannot open critical file, ... where a dump is not wanted.
50  *  M_TERM        Bacula daemon shutting down because of request (SIGTERM).
51  *
52  * The remaining apply to Jobs rather than the daemon.
53  *
54  *  M_FATAL       Bacula detected a fatal Job error. The Job will be killed,
55  *                  but Bacula continues running.
56  *  M_ERROR       Bacula detected a Job error. The Job will continue running
57  *                  but the termination status will be error. 
58  *  M_WARNING     Job warning message.
59  *  M_INFO        Job information message.
60  *
61  */
62
63 #define M_DEBUG       1               /* debug message */
64 #define M_ABORT       2               /* MUST abort immediately */
65 #define M_FATAL       3               /* Fatal error, stopping job */
66 #define M_ERROR       4               /* Error, but recoverable */
67 #define M_WARNING     5               /* Warning message */
68 #define M_INFO        6               /* Informational message */
69 #define M_SAVED       7               /* Info on saved file */
70 #define M_NOTSAVED    8               /* Info on notsaved file */
71 #define M_SKIPPED     9               /* File skipped by option setting */
72 #define M_MOUNT      10               /* Mount requests */
73 #define M_ERROR_TERM 11               /* Error termination request (no dump) */
74 #define M_TERM       12               /* Terminating daemon */
75
76 #define M_MAX      M_TERM             /* keep this updated ! */
77
78 /* Define message destination structure */
79 /* *** FIXME **** where should be extended to handle multiple values */
80 typedef struct s_dest {
81    struct s_dest *next;
82    int dest_code;                     /* destination (one of the MD_ codes) */
83    int max_len;                       /* max mail line length */
84    FILE *fd;                          /* file descriptor */
85    char msg_types[nbytes_for_bits(M_MAX+1)]; /* message type mask */
86    char *where;                       /* filename/program name */
87    char *mail_cmd;                    /* mail command */
88    POOLMEM *mail_filename;            /* unique mail filename */
89 } DEST;
90
91 /* Message Destination values for dest field of DEST */
92 #define MD_SYSLOG    1                /* send msg to syslog */
93 #define MD_MAIL      2                /* email group of messages */
94 #define MD_FILE      3                /* write messages to a file */
95 #define MD_APPEND    4                /* append messages to a file */
96 #define MD_STDOUT    5                /* print messages */
97 #define MD_STDERR    6                /* print messages to stderr */
98 #define MD_DIRECTOR  7                /* send message to the Director */
99 #define MD_OPERATOR  8                /* email a single message to the operator */
100 #define MD_CONSOLE   9                /* send msg to UserAgent or console */
101 #define MD_MAIL_ON_ERROR 10           /* email messages if job errors */
102
103
104 void d_msg(char *file, int line, int level, char *fmt,...);
105 void e_msg(char *file, int line, int type, int level, char *fmt,...);
106 void Jmsg(void *vjcr, int type, int level, char *fmt,...);
107
108 extern int debug_level;
109 extern char my_name[];
110 extern char *working_directory;
111 extern time_t daemon_start_time;