File: evtfmt.c

package info (click to toggle)
eventlog 0.2.12-6
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 356 kB
  • ctags: 166
  • sloc: ansic: 896; sh: 148; makefile: 127
file content (29 lines) | stat: -rw-r--r-- 731 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "evtlog.h"
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>

int
main(void)
{
  EVTCONTEXT *ctx;
  EVTREC *e;
  char *es;
  
  ctx = evt_ctx_init("evtfmt", LOG_AUTH);
  e = evt_rec_init(ctx, LOG_INFO, "Test message with an embedded ';' in it. It also contains an <XML> like tag.");
  evt_rec_add_tags(e, 
                   evt_tag_str("test:tag", "'value'"),
                   evt_tag_str("test:tag2", "\n\n\n\n"),
                   evt_tag_int("test:fd", fileno(stderr)),
                   evt_tag_errno("test:error", EAGAIN),
                   evt_tag_printf("test:printf", "%d %d", 5, 6),
                   NULL);
  
  es = evt_format(e);
  printf("%s\n", es);
  free(es);
  
  evt_log(e);
  return 0;
}