File: rdf_log.h

package info (click to toggle)
redland 1.0.7-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 27,592 kB
  • ctags: 12,328
  • sloc: ansic: 79,017; xml: 25,115; sh: 10,162; yacc: 5,985; lex: 3,682; makefile: 3,260; perl: 2,814; cpp: 59
file content (171 lines) | stat: -rw-r--r-- 4,523 bytes parent folder | download
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
/* -*- Mode: c; c-basic-offset: 2 -*-
 *
 * rdf_log.h - RDF logging interfaces
 *
 * $Id: rdf_log.h 13238 2007-11-19 10:56:29Z laalto $
 *
 * Copyright (C) 2004-2006, David Beckett http://purl.org/net/dajobe/
 * Copyright (C) 2004-2005, University of Bristol, UK http://www.bristol.ac.uk/
 * 
 * This package is Free Software and part of Redland http://librdf.org/
 * 
 * It is licensed under the following three licenses as alternatives:
 *   1. GNU Lesser General Public License (LGPL) V2.1 or any newer version
 *   2. GNU General Public License (GPL) V2 or any newer version
 *   3. Apache License, V2.0 or any newer version
 * 
 * You may not use this file except in compliance with at least one of
 * the above three licenses.
 * 
 * See LICENSE.html or LICENSE.txt at the top of this package for the
 * complete terms and further detail along with the license texts for
 * the licenses in COPYING.LIB, COPYING and LICENSE-2.0.txt respectively.
 * 
 * 
 */


#ifndef LIBRDF_LOG_H
#define LIBRDF_LOG_H

#ifdef __cplusplus
extern "C" {
#endif

#include <raptor.h>

/**
 * librdf_log_level:
 * @LIBRDF_LOG_NONE: No level
 * @LIBRDF_LOG_DEBUG: Debug.
 * @LIBRDF_LOG_INFO: Information.
 * @LIBRDF_LOG_WARN: Warning.
 * @LIBRDF_LOG_ERROR: Recoverable error.  Program can continue.
 * @LIBRDF_LOG_FATAL: Fatal error.  Program will abort if this is not caught.
 * @LIBRDF_LOG_LAST: Internal, never returned.
 *
 * Indicates the level of the log message.
 */
typedef enum {
  LIBRDF_LOG_NONE = 0,
  LIBRDF_LOG_DEBUG,
  LIBRDF_LOG_INFO,
  LIBRDF_LOG_WARN,
  LIBRDF_LOG_ERROR,
  LIBRDF_LOG_FATAL,
  LIBRDF_LOG_LAST=LIBRDF_LOG_FATAL
} librdf_log_level;
  

/**
 * librdf_log_facility:
 * @LIBRDF_FROM_CONCEPTS: Concepts
 * @LIBRDF_FROM_DIGEST: Digest
 * @LIBRDF_FROM_FILES: Files
 * @LIBRDF_FROM_HASH: Hash
 * @LIBRDF_FROM_INIT: Init
 * @LIBRDF_FROM_ITERATOR: Iterator
 * @LIBRDF_FROM_LIST: List
 * @LIBRDF_FROM_MODEL: Model
 * @LIBRDF_FROM_NODE: Node
 * @LIBRDF_FROM_PARSER: Parser
 * @LIBRDF_FROM_QUERY: Query
 * @LIBRDF_FROM_SERIALIZER: Serializer
 * @LIBRDF_FROM_STATEMENT: Statement
 * @LIBRDF_FROM_STORAGE: Storage
 * @LIBRDF_FROM_STREAM: Stream
 * @LIBRDF_FROM_URI: URI
 * @LIBRDF_FROM_UTF8: UTF8
 * @LIBRDF_FROM_MEMORY: Memory
 * @LIBRDF_FROM_NONE: Associated with no part.
 * @LIBRDF_FROM_LAST: Internal, never returned.
 *
 * Indicates the part of the system that generated the log message.
 */
typedef enum {
  LIBRDF_FROM_NONE = 0,
  LIBRDF_FROM_CONCEPTS,
  LIBRDF_FROM_DIGEST,
  LIBRDF_FROM_FILES,
  LIBRDF_FROM_HASH,
  LIBRDF_FROM_INIT,
  LIBRDF_FROM_ITERATOR,
  LIBRDF_FROM_LIST,
  LIBRDF_FROM_MODEL,
  LIBRDF_FROM_NODE,
  LIBRDF_FROM_PARSER,
  LIBRDF_FROM_QUERY,
  LIBRDF_FROM_SERIALIZER,
  LIBRDF_FROM_STATEMENT,
  LIBRDF_FROM_STORAGE,
  LIBRDF_FROM_STREAM,
  LIBRDF_FROM_URI,
  LIBRDF_FROM_UTF8,
  LIBRDF_FROM_MEMORY,
  LIBRDF_FROM_LAST=LIBRDF_FROM_MEMORY
} librdf_log_facility;
  

/**
 * librdf_log_message:
 *
 * Structure for storing parts of a log message generated by Redland.
 */
typedef struct 
{
  int code;                  /* The error code */
  librdf_log_level level;
  librdf_log_facility facility;
  const char *message;
  /* valid for certain facilities such as LIBRDF_FROM_PARSER */
  raptor_locator *locator;
} librdf_log_message;


/**
 * librdf_log_level_func:
 * @user_data: User data pointer
 * @message: Log message.
 * @arguments: Message arguments.
 *
 * Handler for one log level, for the warning and error levels ONLY.
 * Used by #librdf_world_set_warning and #librdf_world_set_error.
 *
 * Return value: non-zero to indicate log message has been handled 
 */
typedef int (*librdf_log_level_func)(void *user_data, const char *message, va_list arguments);

/**
 * librdf_log_func:
 * @user_data: User data pointer
 * @message: Log message structure pointer.
 *
 * Handler for all log levels.
 *
 * Return value: non-zero to indicate log message has been handled 
 */
typedef int (*librdf_log_func)(void *user_data, librdf_log_message *message);

#ifdef LIBRDF_INTERNAL
#include <rdf_log_internal.h>
#endif


/* log message accessors */
REDLAND_API
int librdf_log_message_code(librdf_log_message *message);
REDLAND_API
librdf_log_level librdf_log_message_level(librdf_log_message *message);
REDLAND_API
librdf_log_facility librdf_log_message_facility(librdf_log_message *message);
REDLAND_API
const char * librdf_log_message_message(librdf_log_message *message);
REDLAND_API
raptor_locator* librdf_log_message_locator(librdf_log_message *message);


#ifdef __cplusplus
}
#endif

#endif