Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 1 | /* |
| 2 | include/proto/log.h |
| 3 | This file contains definitions of log-related functions, structures, |
| 4 | and macros. |
| 5 | |
Willy Tarreau | ec6c5df | 2008-07-15 00:22:45 +0200 | [diff] [blame] | 6 | Copyright (C) 2000-2008 Willy Tarreau - w@1wt.eu |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 7 | |
| 8 | This library is free software; you can redistribute it and/or |
| 9 | modify it under the terms of the GNU Lesser General Public |
| 10 | License as published by the Free Software Foundation, version 2.1 |
| 11 | exclusively. |
| 12 | |
| 13 | This library is distributed in the hope that it will be useful, |
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 | Lesser General Public License for more details. |
| 17 | |
| 18 | You should have received a copy of the GNU Lesser General Public |
| 19 | License along with this library; if not, write to the Free Software |
| 20 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 21 | */ |
| 22 | |
| 23 | #ifndef _PROTO_LOG_H |
| 24 | #define _PROTO_LOG_H |
| 25 | |
| 26 | #include <stdio.h> |
| 27 | #include <syslog.h> |
| 28 | |
Willy Tarreau | e3ba5f0 | 2006-06-29 18:54:54 +0200 | [diff] [blame] | 29 | #include <common/config.h> |
Willy Tarreau | 332f8bf | 2007-05-13 21:36:56 +0200 | [diff] [blame] | 30 | #include <common/memory.h> |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 31 | #include <types/log.h> |
| 32 | #include <types/proxy.h> |
| 33 | #include <types/session.h> |
| 34 | |
Willy Tarreau | 332f8bf | 2007-05-13 21:36:56 +0200 | [diff] [blame] | 35 | extern struct pool_head *pool2_requri; |
| 36 | |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 37 | /* |
| 38 | * Displays the message on stderr with the date and pid. Overrides the quiet |
| 39 | * mode during startup. |
| 40 | */ |
Willy Tarreau | 40d2516 | 2009-04-03 12:01:47 +0200 | [diff] [blame] | 41 | void Alert(const char *fmt, ...) |
| 42 | __attribute__ ((format(printf, 1, 2))); |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 43 | |
| 44 | /* |
| 45 | * Displays the message on stderr with the date and pid. |
| 46 | */ |
Willy Tarreau | 40d2516 | 2009-04-03 12:01:47 +0200 | [diff] [blame] | 47 | void Warning(const char *fmt, ...) |
| 48 | __attribute__ ((format(printf, 1, 2))); |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 49 | |
| 50 | /* |
| 51 | * Displays the message on <out> only if quiet mode is not set. |
| 52 | */ |
Willy Tarreau | 40d2516 | 2009-04-03 12:01:47 +0200 | [diff] [blame] | 53 | void qfprintf(FILE *out, const char *fmt, ...) |
| 54 | __attribute__ ((format(printf, 2, 3))); |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 55 | |
| 56 | /* |
| 57 | * This function sends a syslog message to both log servers of a proxy, |
| 58 | * or to global log servers if the proxy is NULL. |
| 59 | * It also tries not to waste too much time computing the message header. |
| 60 | * It doesn't care about errors nor does it report them. |
| 61 | */ |
Willy Tarreau | 40d2516 | 2009-04-03 12:01:47 +0200 | [diff] [blame] | 62 | void send_log(struct proxy *p, int level, const char *message, ...) |
| 63 | __attribute__ ((format(printf, 3, 4))); |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 64 | |
| 65 | /* |
| 66 | * send a log for the session when we have enough info about it |
| 67 | */ |
Willy Tarreau | 4225058 | 2007-04-01 01:30:43 +0200 | [diff] [blame] | 68 | void tcp_sess_log(struct session *s); |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 69 | |
| 70 | /* |
| 71 | * returns log level for <lev> or -1 if not found. |
| 72 | */ |
| 73 | int get_log_level(const char *lev); |
| 74 | |
| 75 | /* |
| 76 | * returns log facility for <fac> or -1 if not found. |
| 77 | */ |
| 78 | int get_log_facility(const char *fac); |
| 79 | |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 80 | #endif /* _PROTO_LOG_H */ |
| 81 | |
| 82 | /* |
| 83 | * Local variables: |
| 84 | * c-indent-level: 8 |
| 85 | * c-basic-offset: 8 |
| 86 | * End: |
| 87 | */ |