log4c  1.2.4
location_info.h
Go to the documentation of this file.
1 /* $Id: location_info.h,v 1.5 2006/12/05 23:07:28 bikeracer4700 Exp $
2  *
3  * location_info.h
4  *
5  * Copyright 2001-2003, Meiosys (www.meiosys.com). All rights reserved.
6 
7 
8  * See the COPYING file for the terms of usage and distribution.
9  */
10 
11 #ifndef log4c_location_info_h
12 #define log4c_location_info_h
13 
23 #include <log4c/defs.h>
24 
25 __LOG4C_BEGIN_DECLS
26 
39 typedef struct
40 {
41  const char* loc_file;
42  int loc_line;
43  const char* loc_function;
44  void* loc_data;
45 
47 
51 #ifdef __GNUC__
52 # define LOG4C_LOCATION_INFO_INITIALIZER(user_data) { __FILE__, __LINE__, __FUNCTION__, user_data }
53 #else
54 # define LOG4C_LOCATION_INFO_INITIALIZER(user_data) { __FILE__, __LINE__, "(nil)", user_data }
55 #endif
56 
57 #define __log4c_str(n) #n
58 
59 #ifdef __GNUC__
60 # define __log4c_location(n) __FUNCTION__ "() at " __FILE__ ":" __log4c_str(n)
61 #else
62 # define __log4c_location(n) __FILE__ ":" __log4c_str(n)
63 #endif
64 
69 #define log4c_location __log4c_location(__LINE__)
70 
71 __LOG4C_END_DECLS
72 
73 #endif