rename to debug.h
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/889ae2e8 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/889ae2e8 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/889ae2e8 Branch: refs/heads/consistent-gzip-error-msgs Commit: 889ae2e8b4943138b66282d6f0bbb3856ebd7346 Parents: d2c4a27 Author: Igor GaliÄ <[email protected]> Authored: Thu Aug 8 17:39:01 2013 +0200 Committer: Igor GaliÄ <[email protected]> Committed: Thu Aug 8 19:39:03 2013 +0200 ---------------------------------------------------------------------- plugins/gzip/debug_macros.h | 3 +- proxy/api/ts/debug.h | 71 ++++++++++++++++++++++++++++++++++++++++ proxy/api/ts/ts-debug.h | 71 ---------------------------------------- 3 files changed, 72 insertions(+), 73 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/889ae2e8/plugins/gzip/debug_macros.h ---------------------------------------------------------------------- diff --git a/plugins/gzip/debug_macros.h b/plugins/gzip/debug_macros.h index b9905be..084c788 100644 --- a/plugins/gzip/debug_macros.h +++ b/plugins/gzip/debug_macros.h @@ -25,8 +25,7 @@ #define _DBG_MACROS_H #define PLUGIN_NAME "gzip" - -#include <ts/ts-debug.h> +#include <ts/debug.h> //FIXME: this one doesn't deserve to be here #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/889ae2e8/proxy/api/ts/debug.h ---------------------------------------------------------------------- diff --git a/proxy/api/ts/debug.h b/proxy/api/ts/debug.h new file mode 100644 index 0000000..7e0854e --- /dev/null +++ b/proxy/api/ts/debug.h @@ -0,0 +1,71 @@ +/** @file + + Traffic Server SDK API header file for debug messages + + @section license License + + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + @section developers Developers + + */ + +#ifndef __TS_DEBUG_H__ +#define __TS_DEBUG_H__ + +#include <ts/ts.h> + +/** all of these APIs assume you've defined PLUGIN_NAME first before + * including this header file. + * + * These APIs are private, that is: They are not installed. They + * can be used by in-tree plugins, external plugins will have to redefine this + * or find their own way of logging, until ATS has unified it's plugin logging + * in the same way it has unified the core-logging. + **/ + +#ifndef PLUGIN_NAME +# error "A plugin must define a PLUGIN_NAME string constant *before* including <ts/ts.h> in order to use TSLog(Debug|Info|Warning|Error|Fatal)" +#else + +#define TSLogDebug(fmt, args...) do { \ + TSDebug(PLUGIN_NAME, "DEBUG: [%s:%d] [%s] " fmt, __FILE__, __LINE__, __func__ , ##args ); \ + } while (0) + +#define TSLogInfo(fmt, args...) do { \ + TSDebug(PLUGIN_NAME, "INFO: " fmt, ##args ); \ + } while (0) + +#define TSLogWarning(fmt, args...) do { \ + TSDebug(PLUGIN_NAME, "WARNING: " fmt, ##args ); \ +} while (0) + +#define TSLogError(fmt, args...) do { \ + TSError("[%s] [%s:%d] [%s] ERROR: " fmt, PLUGIN_NAME, __FILE__, __LINE__, __func__ , ##args ); \ + TSDebug(PLUGIN_NAME, "[%s:%d] [%s] ERROR: " fmt, __FILE__, __LINE__, __func__ , ##args ); \ +} while (0) +#endif + +#define TSLogFatal(fmt, args...) do { \ + TSError("[%s] [%s:%d] [%s] FATAL: " fmt, PLUGIN_NAME, __FILE__, __LINE__, __func__ , ##args ); \ + TSDebug(PLUGIN_NAME, "[%s:%d] [%s] FATAL: " fmt, __FILE__, __LINE__, __func__ , ##args ); \ + exit(-1); \ +} while (0) + + +# endif /* __TS_DEBUG_H__ */ + http://git-wip-us.apache.org/repos/asf/trafficserver/blob/889ae2e8/proxy/api/ts/ts-debug.h ---------------------------------------------------------------------- diff --git a/proxy/api/ts/ts-debug.h b/proxy/api/ts/ts-debug.h deleted file mode 100644 index 7e0854e..0000000 --- a/proxy/api/ts/ts-debug.h +++ /dev/null @@ -1,71 +0,0 @@ -/** @file - - Traffic Server SDK API header file for debug messages - - @section license License - - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - @section developers Developers - - */ - -#ifndef __TS_DEBUG_H__ -#define __TS_DEBUG_H__ - -#include <ts/ts.h> - -/** all of these APIs assume you've defined PLUGIN_NAME first before - * including this header file. - * - * These APIs are private, that is: They are not installed. They - * can be used by in-tree plugins, external plugins will have to redefine this - * or find their own way of logging, until ATS has unified it's plugin logging - * in the same way it has unified the core-logging. - **/ - -#ifndef PLUGIN_NAME -# error "A plugin must define a PLUGIN_NAME string constant *before* including <ts/ts.h> in order to use TSLog(Debug|Info|Warning|Error|Fatal)" -#else - -#define TSLogDebug(fmt, args...) do { \ - TSDebug(PLUGIN_NAME, "DEBUG: [%s:%d] [%s] " fmt, __FILE__, __LINE__, __func__ , ##args ); \ - } while (0) - -#define TSLogInfo(fmt, args...) do { \ - TSDebug(PLUGIN_NAME, "INFO: " fmt, ##args ); \ - } while (0) - -#define TSLogWarning(fmt, args...) do { \ - TSDebug(PLUGIN_NAME, "WARNING: " fmt, ##args ); \ -} while (0) - -#define TSLogError(fmt, args...) do { \ - TSError("[%s] [%s:%d] [%s] ERROR: " fmt, PLUGIN_NAME, __FILE__, __LINE__, __func__ , ##args ); \ - TSDebug(PLUGIN_NAME, "[%s:%d] [%s] ERROR: " fmt, __FILE__, __LINE__, __func__ , ##args ); \ -} while (0) -#endif - -#define TSLogFatal(fmt, args...) do { \ - TSError("[%s] [%s:%d] [%s] FATAL: " fmt, PLUGIN_NAME, __FILE__, __LINE__, __func__ , ##args ); \ - TSDebug(PLUGIN_NAME, "[%s:%d] [%s] FATAL: " fmt, __FILE__, __LINE__, __func__ , ##args ); \ - exit(-1); \ -} while (0) - - -# endif /* __TS_DEBUG_H__ */ -
