2013-12-29 04:53:12 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2013 Glyptodon LLC
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
* THE SOFTWARE.
|
|
|
|
*/
|
2013-10-25 01:19:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
#ifndef __GUAC_RDP_DEBUG_H
|
|
|
|
#define __GUAC_RDP_DEBUG_H
|
|
|
|
|
2014-01-01 22:44:28 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
2013-10-25 01:19:21 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2013-12-12 06:27:35 +00:00
|
|
|
/* Ensure GUAC_RDP_DEBUG_LEVEL is defined to a constant */
|
|
|
|
#ifndef GUAC_RDP_DEBUG_LEVEL
|
|
|
|
#define GUAC_RDP_DEBUG_LEVEL 0
|
2013-10-25 01:19:21 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Prints a message to STDERR using the given printf format string and
|
2013-12-12 06:27:35 +00:00
|
|
|
* arguments. This will only do anything if the GUAC_RDP_DEBUG_LEVEL
|
|
|
|
* macro is defined and greater than the given log level.
|
2013-10-25 01:19:21 +00:00
|
|
|
*
|
|
|
|
* @param level The desired log level (an integer).
|
|
|
|
* @param fmt The format to use when printing.
|
|
|
|
* @param ... Arguments corresponding to conversion specifiers in the format
|
|
|
|
* string.
|
|
|
|
*/
|
|
|
|
#define GUAC_RDP_DEBUG(level, fmt, ...) \
|
|
|
|
do { \
|
2013-12-12 06:27:35 +00:00
|
|
|
if (GUAC_RDP_DEBUG_LEVEL >= level) \
|
|
|
|
fprintf(stderr, "%s:%d: %s(): " fmt "\n", \
|
2013-10-25 01:19:21 +00:00
|
|
|
__FILE__, __LINE__, __func__, __VA_ARGS__); \
|
|
|
|
} while (0);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|