logger.h 704 字节
Newer Older
W
wangguibao 已提交
1 2 3 4 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 36
#ifndef BAIDU_PADDLE_SERVING_PREDICTOR_LOGGER_H
#define BAIDU_PADDLE_SERVING_PREDICTOR_LOGGER_H

#include <base/comlog_sink.h>
#include "common/inner_common.h"

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