# location_info.h

Go to the documentation of this file.

    00001 /* $Id$
    00002  *
    00003  * location_info.h
    00004  *
    00005  * Copyright 2001-2003, Meiosys (www.meiosys.com). All rights reserved.
    00006
    00007
    00008  * See the COPYING file for the terms of usage and distribution.
    00009  */
    00010
    00011 #ifndef log4c_location_info_h
    00012 #define log4c_location_info_h
    00013
    00023 #include <log4c/defs.h>
    00024
    00025 __LOG4C_BEGIN_DECLS
    00026
    00039 typedef struct
    00040 {
    00041     const char* loc_file;
    00042     int loc_line;
    00043     const char* loc_function;
    00044     void* loc_data;
    00045
    00046 } log4c_location_info_t;
    00047
    00051 #ifdef __GNUC__
    00052 #   define LOG4C_LOCATION_INFO_INITIALIZER(user_data) { __FILE__, __LINE__, __FUNCTION__, user_data }
    00053 #else
    00054 #   define LOG4C_LOCATION_INFO_INITIALIZER(user_data) { __FILE__, __LINE__, "(nil)", user_data }
    00055 #endif
    00056
    00057 #define __log4c_str(n) #n
    00058
    00059 #ifdef __GNUC__
    00060 #   define __log4c_location(n)  __FUNCTION__ "() at " __FILE__ ":" __log4c_str(n)
    00061 #else
    00062 #   define __log4c_location(n)  __FILE__ ":" __log4c_str(n)
    00063 #endif
    00064
    00069 #define log4c_location __log4c_location(__LINE__)
    00070
    00071 __LOG4C_END_DECLS
    00072
    00073 #endif