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_0_1_6:1.3
FSL_0_1_5:1.3
FSL_0_1_1:1.3
LMTP2NNTP_1_2a5:1.3
LMTP2NNTP_1_2a4:1.3
LMTP2NNTP_1_2a3:1.3
LMTP2NNTP_1_2a1:1.2;
locks; strict;
comment @ * @;
1.6
date 2005.10.03.08.08.11; author rse; state Exp;
branches;
next 1.5;
1.5
date 2005.01.24.15.03.18; author rse; state Exp;
branches;
next 1.4;
1.4
date 2003.01.06.11.41.52; author rse; state Exp;
branches;
next 1.3;
1.3
date 2001.12.14.12.42.07; author rse; state Exp;
branches;
next 1.2;
1.2
date 2001.11.07.16.30.51; author rse; state Exp;
branches;
next 1.1;
1.1
date 2001.11.07.16.17.09; author rse; state Exp;
branches;
next ;
desc
@@
1.6
log
@Adjust copyright messages for new year 2005.
@
text
@/*
** OSSP l2 - Flexible Logging
** Copyright (c) 2001-2005 Cable & Wireless
** Copyright (c) 2001-2005 The OSSP Project
** Copyright (c) 2001-2005 Ralf S. Engelschall
**
** This file is part of OSSP l2, a flexible logging library which
** can be found at http://www.ossp.org/pkg/lib/l2/.
**
** Permission to use, copy, modify, and distribute this software for
** any purpose with or without fee is hereby granted, provided that
** the above copyright notice and this permission notice appear in all
** copies.
**
** THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
** IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
** USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
** SUCH DAMAGE.
**
** l2_spec.h: specification common header
*/
#ifndef __L2_SPEC_H__
#define __L2_SPEC_H__
#include "l2.h"
/* internal specification scanner/parser context */
typedef struct {
const char *inputptr; /* input buffer: current reading pointer */
const char *inputbuf; /* input buffer: begin of buffer */
size_t inputlen; /* input buffer: size of buffer */
l2_env_t *env; /* environment for channel create & error remember */
l2_channel_t *ch; /* top-level/root/result channel */
l2_channel_t *chTmp; /* temporary channel needed in the parser */
l2_result_t rv; /* return value */
void *yyscan; /* Flex scanner context */
} l2_spec_ctx_t;
/* internal scanner/parser token location */
typedef struct {
int first;
int last;
} l2_spec_loc_t;
#define YYLTYPE l2_spec_loc_t
/* support for automatic location tracking by Bison */
#define first_line first
#define first_column first
#define last_line last
#define last_column last
/* error reporting function */
extern void l2_spec_error(l2_spec_ctx_t *ctx, l2_result_t rv, YYLTYPE *loc, const char *fmt, ...);
#endif /* __L2_SPEC_H__ */
@
1.5
log
@Adjust copyright messages for new year 2005.
@
text
@d3 3
a5 3
** Copyright (c) 2001-2004 Cable & Wireless
** Copyright (c) 2001-2004 The OSSP Project
** Copyright (c) 2001-2004 Ralf S. Engelschall
@
1.4
log
@- remove trailing whitespaces
- adjust copyright messages
- consistently use "OSSP l2"
- consistently talk about "Flexible Logging"
- use standard OSSP ASCII-art
@
text
@d3 3
a5 3
** Copyright (c) 2001-2003 Cable & Wireless Deutschland GmbH
** Copyright (c) 2001-2003 The OSSP Project (http://www.ossp.org/)
** Copyright (c) 2001-2003 Ralf S. Engelschall
@
1.3
log
@Whoohooo! Add support for location tracking. This way the reported
errors contain line, column, context and found/expected information.
Now the specification parser is full featured...
@
text
@d1 30
@
1.2
log
@cleanup and document
@
text
@d6 1
d17 16
@
1.1
log
@HEADS UP, guys:
Here comes the first cut for the long-awaited channel tree specification
parser and channel tree builder. This certainly makes L2 finally _THE_ killer
library in the logging field. Woohooo... and the crowd goes wild!
It allows one to build an arbitrary complex logging channel tree
out of a single textual specification. An example follows:
noop -> {
prefix(prefix="[%d-%m-%Y/%H:%M:%S] %L test[%P]: ", timezone="local")
-> filter(regex="hecking", negate="0")
-> buffer(size="800")
-> file(path="l2_test.log",append="1",perm="420");
error: syslog(ident="L2-Test", facility="user",
remotehost="en1", logpid="1", target="remote");
panic: smtp(rcpt="rse@@engelschall.com", host="en1", port="25"
}
This allows one to log nice timestamp-prefixed messages containing the
word "hecking" to a buffered file. Additionally if the message has a
level higher or equal to "error" it also logs it remotely via UDP to the
syslogd on en1. And additionally if the message is a panic message, it
is also sent out as an Email via SMTP to the MTA on en1.
Ever thought a C library has to be dull and simple? ;)
PS: This stuff certainly needs more polishing and cleanup and also
a few things I'll enhance in the future (for instance to remove the
restriction that parameter values have to be in quotation marks, etc.).
@
text
@d7 8
a14 8
const char *inputptr;
const char *inputbuf;
size_t inputlen;
l2_env_t *env;
l2_channel_t *ch;
l2_channel_t *chTmp;
l2_result_t rv;
void *yyscan;
a15 2
extern int l2_spec_parse(void *);
@