xref: /redis-3.2.3/src/debugmacro.h (revision fdafe233)
1*fdafe233Santirez /* This file contains debugging macros to be used when investigating issues.
2*fdafe233Santirez  *
3*fdafe233Santirez  * -----------------------------------------------------------------------------
4*fdafe233Santirez  *
5*fdafe233Santirez  * Copyright (c) 2016, Salvatore Sanfilippo <antirez at gmail dot com>
6*fdafe233Santirez  * All rights reserved.
7*fdafe233Santirez  *
8*fdafe233Santirez  * Redistribution and use in source and binary forms, with or without
9*fdafe233Santirez  * modification, are permitted provided that the following conditions are met:
10*fdafe233Santirez  *
11*fdafe233Santirez  *   * Redistributions of source code must retain the above copyright notice,
12*fdafe233Santirez  *     this list of conditions and the following disclaimer.
13*fdafe233Santirez  *   * Redistributions in binary form must reproduce the above copyright
14*fdafe233Santirez  *     notice, this list of conditions and the following disclaimer in the
15*fdafe233Santirez  *     documentation and/or other materials provided with the distribution.
16*fdafe233Santirez  *   * Neither the name of Redis nor the names of its contributors may be used
17*fdafe233Santirez  *     to endorse or promote products derived from this software without
18*fdafe233Santirez  *     specific prior written permission.
19*fdafe233Santirez  *
20*fdafe233Santirez  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21*fdafe233Santirez  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22*fdafe233Santirez  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23*fdafe233Santirez  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24*fdafe233Santirez  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25*fdafe233Santirez  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26*fdafe233Santirez  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27*fdafe233Santirez  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28*fdafe233Santirez  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29*fdafe233Santirez  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30*fdafe233Santirez  * POSSIBILITY OF SUCH DAMAGE.
31*fdafe233Santirez  */
32*fdafe233Santirez 
33*fdafe233Santirez #include <stdio.h>
34*fdafe233Santirez #define D(...)                                                               \
35*fdafe233Santirez     do {                                                                     \
36*fdafe233Santirez         FILE *fp = fopen("/tmp/log.txt","a");                                \
37*fdafe233Santirez         fprintf(fp,"%s:%s:%d:\t", __FILE__, __FUNCTION__, __LINE__);         \
38*fdafe233Santirez         fprintf(fp,__VA_ARGS__);                                             \
39*fdafe233Santirez         fprintf(fp,"\n");                                                    \
40*fdafe233Santirez         fclose(fp);                                                          \
41*fdafe233Santirez     } while (0);
42