blob: 7a74c82334198d9eb631c9b2684e2905b75962a0 [file] [log] [blame]
Willy Tarreaubaaee002006-06-26 02:48:02 +02001/*
2 include/proto/log.h
3 This file contains definitions of log-related functions, structures,
4 and macros.
5
6 Copyright (C) 2000-2006 Willy Tarreau - w@1wt.eu
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 Tarreaue3ba5f02006-06-29 18:54:54 +020029#include <common/config.h>
Willy Tarreaubaaee002006-06-26 02:48:02 +020030#include <types/log.h>
31#include <types/proxy.h>
32#include <types/session.h>
33
34/*
35 * Displays the message on stderr with the date and pid. Overrides the quiet
36 * mode during startup.
37 */
38void Alert(char *fmt, ...);
39
40/*
41 * Displays the message on stderr with the date and pid.
42 */
43void Warning(char *fmt, ...);
44
45/*
46 * Displays the message on <out> only if quiet mode is not set.
47 */
48void qfprintf(FILE *out, char *fmt, ...);
49
50/*
51 * This function sends a syslog message to both log servers of a proxy,
52 * or to global log servers if the proxy is NULL.
53 * It also tries not to waste too much time computing the message header.
54 * It doesn't care about errors nor does it report them.
55 */
56void send_log(struct proxy *p, int level, char *message, ...);
57
58/*
59 * send a log for the session when we have enough info about it
60 */
61void sess_log(struct session *s);
62
63/*
64 * returns log level for <lev> or -1 if not found.
65 */
66int get_log_level(const char *lev);
67
68/*
69 * returns log facility for <fac> or -1 if not found.
70 */
71int get_log_facility(const char *fac);
72
73/*
74 * Initializes some data needed later.
75 */
76void init_log();
77
78#endif /* _PROTO_LOG_H */
79
80/*
81 * Local variables:
82 * c-indent-level: 8
83 * c-basic-offset: 8
84 * End:
85 */