logger.h 672 字节
Newer Older
W
wangguibao 已提交
1 2 3
#ifndef BAIDU_PADDLE_SERVING_PREDICTOR_LOGGER_H
#define BAIDU_PADDLE_SERVING_PREDICTOR_LOGGER_H

W
wangguibao 已提交
4
#include <butil/comlog_sink.h>
W
wangguibao 已提交
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35

namespace baidu {
namespace paddle_serving {
namespace predictor {

class LoggerWrapper {
public:
    static LoggerWrapper& instance() {
        static LoggerWrapper lw;
        return lw;
    }

    int initialize(const std::string& path, const std::string& name) {
        if (com_loadlog(path.c_str(), name.c_str()) != 0) {
            LOG(ERROR) << "Fail to com_loadlog from: "
                << path << "/" << name;
            return -1;
        }
        return 0;
    }

    int finalize() {
        return 0;
    }
};

}
}
}

#endif