• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*******************************************************************************
2  * Copyright (c) 2009, 2013 IBM Corp.
3  *
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * and Eclipse Distribution License v1.0 which accompany this distribution.
7  *
8  * The Eclipse Public License is available at
9  *    http://www.eclipse.org/legal/epl-v10.html
10  * and the Eclipse Distribution License is available at
11  *   http://www.eclipse.org/org/documents/edl-v10.php.
12  *
13  * Contributors:
14  *    Ian Craggs - initial API and implementation and/or initial documentation
15  *    Ian Craggs - updates for the async client
16  *******************************************************************************/
17 
18 #if !defined(LOG_H)
19 #define LOG_H
20 
21 /*BE
22 map LOG_LEVELS
23 {
24 	"TRACE_MAXIMUM" 1
25 	"TRACE_MEDIUM" 2
26 	"TRACE_MINIMUM" 3
27 	"TRACE_PROTOCOL" 4
28 
29 	"ERROR" 5
30 	"SEVERE" 6
31 	"FATAL" 7
32 }
33 BE*/
34 
35 enum LOG_LEVELS {
36 	INVALID_LEVEL = -1,
37 	TRACE_MAXIMUM = 1,
38 	TRACE_MEDIUM,
39 	TRACE_MINIMUM,
40 	TRACE_PROTOCOL,
41 	LOG_ERROR,
42 	LOG_SEVERE,
43 	LOG_FATAL,
44 };
45 
46 
47 /*BE
48 def trace_settings_type
49 {
50    n32 map LOG_LEVELS "trace_level"
51    n32 dec "max_trace_entries"
52    n32 dec "trace_output_level"
53 }
54 BE*/
55 typedef struct
56 {
57 	enum LOG_LEVELS trace_level;	/**< trace level */
58 	int max_trace_entries;		/**< max no of entries in the trace buffer */
59 	enum LOG_LEVELS trace_output_level;		/**< trace level to output to destination */
60 } trace_settings_type;
61 
62 extern trace_settings_type trace_settings;
63 
64 #define LOG_PROTOCOL TRACE_PROTOCOL
65 #define TRACE_MAX TRACE_MAXIMUM
66 #define TRACE_MIN TRACE_MINIMUM
67 #define TRACE_MED TRACE_MEDIUM
68 
69 typedef struct
70 {
71 	const char* name;
72 	const char* value;
73 } Log_nameValue;
74 
75 int Log_initialize(Log_nameValue*);
76 void Log_terminate(void);
77 
78 void Log(enum LOG_LEVELS, int, const char *, ...);
79 void Log_stackTrace(enum LOG_LEVELS, int, int, int, const char*, int, int*);
80 
81 typedef void Log_traceCallback(enum LOG_LEVELS level, const char *message);
82 void Log_setTraceCallback(Log_traceCallback* callback);
83 void Log_setTraceLevel(enum LOG_LEVELS level);
84 
85 #endif
86