blob: ae1d4af78fae8df876c54bbfb54e6249be40421d [file] [log] [blame]
Stephen Hines5b948192012-05-03 12:26:56 -07001/*
Stephen Hines2f6a4932012-05-03 12:27:13 -07002 * Copyright 2010, The Android Open Source Project
Stephen Hines5b948192012-05-03 12:26:56 -07003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Stephen Hines2f6a4932012-05-03 12:27:13 -070017#ifndef BCC_DEBUGHELPER_H
18#define BCC_DEBUGHELPER_H
Stephen Hines5b948192012-05-03 12:26:56 -070019
Stephen Hines2f6a4932012-05-03 12:27:13 -070020#include "Config.h"
Stephen Hines5b948192012-05-03 12:26:56 -070021
22#define LOG_TAG "bcc"
23#include <cutils/log.h>
24
25#if !USE_FUNC_LOGGER
26
27#define BCC_FUNC_LOGGER()
28
29#else // USE_FUNC_LOGGER
30
31#if defined(__cplusplus)
32namespace bcc {
33 class FuncLogger {
34 private:
35 char const *mFuncName;
36
37 public:
38 FuncLogger(char const *name) : mFuncName(name) {
39 ALOGD("---> BEGIN: libbcc [ %s ]\n", name);
40 }
41
42 ~FuncLogger() {
43 ALOGD("---> END: libbcc [ %s ]\n", mFuncName);
44 }
45 };
46} // namespace bcc
47
48#define BCC_FUNC_LOGGER() bcc::FuncLogger XX__FuncLogger(__func__)
49#endif
50
51#endif
52
Stephen Hines2f6a4932012-05-03 12:27:13 -070053#endif // BCC_DEBUGHELPER_H