Logging.h 1.2 KB
Newer Older
1
/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.
Z
zhangjinchao01 已提交
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

Licensed 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. */

/*
 * Basically from tensorflow/core/platform/default/logging.h
 * Used in embedded system where there is no glogs.
 */

#pragma once
#include <memory>
Y
Yu Yang 已提交
22
#include <sstream>
Z
zhangjinchao01 已提交
23 24
#include <string>

25
#include <glog/logging.h>
Z
zhangjinchao01 已提交
26 27 28 29 30
namespace paddle {

void initializeLogging(int argc, char** argv);

namespace logging {
31

Z
zhangjinchao01 已提交
32
void setMinLogLevel(int level);
33

Z
zhangjinchao01 已提交
34
void installFailureFunction(void (*callback)());
35

36
void installFailureWriter(void (*callback)(const char*, int));
37 38 39

}  // namespace logging
}  // namespace paddle
Z
zhangjinchao01 已提交
40

41
#ifndef NDEBUG
Z
zhangjinchao01 已提交
42 43 44 45 46
#define DEBUG_LEVEL 5
#define DBG VLOG(DEBUG_LEVEL)
#else
#define DBG DLOG(INFO)
#endif