| 132 | |
| 133 | |
| 134 | int init_xlog(void) |
| 135 | { |
| 136 | if (log_buf == NULL) { |
| 137 | if (buf_init()) { |
| 138 | LM_ERR("Cannot print message!\n"); |
| 139 | return -1; |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | xlog_level_shared = (int*)shm_malloc(sizeof(int)); |
| 144 | if (xlog_level_shared==NULL) { |
| 145 | LM_ERR("failed to allocate shared holder for xlog\n"); |
| 146 | return -1; |
| 147 | } |
| 148 | xlog_level = xlog_level_shared; |
| 149 | *xlog_level = xlog_level_default; |
| 150 | |
| 151 | if (register_trace_type) |
| 152 | xlog_proto_id = register_trace_type((char *)xlog_id_s); |
| 153 | |
| 154 | memset(&tprot, 0, sizeof(trace_proto_t)); |
| 155 | if (global_trace_api) { |
| 156 | memcpy(&tprot, global_trace_api, sizeof(trace_proto_t)); |
| 157 | } else { |
| 158 | if (trace_prot_bind(XLOG_TRACE_API_MODULE, &tprot)) { |
| 159 | LM_DBG("failed to load trace protocol!\n"); |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | |
| 164 | return 0; |
| 165 | } |
| 166 | |
| 167 | |
| 168 | static inline void add_xlog_data(trace_message message, void* param) |
nothing calls this directly
no test coverage detected