blob: 8653a688ef0317dabeeaf55db9779d3b939affe7 [file] [log] [blame]
Logan2f789f32011-02-28 05:21:17 +08001/*
2 * Copyright 2010, The Android Open Source Project
3 *
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
17#ifndef BCC_DEBUGHELPER_H
18#define BCC_DEBUGHELPER_H
19
20#include "Config.h"
21
22#if USE_LOGGER
23
24#define LOG_TAG "bcc"
25#include <cutils/log.h>
26
27#else // !USE_LOGGER
28
29#undef LOGV
30#undef LOGI
31#undef LOGD
32#undef LOGW
33#undef LOGE
34#undef LOGA
35
36#define LOGV(...)
37#define LOGI(...)
38#define LOGD(...)
39#define LOGW(...)
40#define LOGE(...)
41#define LOGA(...)
42
43#endif
44
45
46#if !USE_FUNC_LOGGER
47
48#define BCC_FUNC_LOGGER()
49
50#else // USE_FUNC_LOGGER
51
52namespace bcc {
53 class FuncLogger {
54 private:
55 char const *mFuncName;
56
57 public:
58 FuncLogger(char const *name) : mFuncName(name) {
59 LOGD("---> BEGIN: libbcc [ %s ]\n", name);
60 }
61
62 ~FuncLogger() {
63 LOGD("---> END: libbcc [ %s ]\n", mFuncName);
64 }
65 };
66} // namespace bcc
67
68#define BCC_FUNC_LOGGER() bcc::FuncLogger XX__FuncLogger(__func__)
69
70#endif
71
72#endif // BCC_DEBUGHELPER_H