LogUtil.cpp 1.8 KB
Newer Older
G
groot 已提交
1 2 3 4 5 6
////////////////////////////////////////////////////////////////////////////////
// Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
// Unauthorized copying of this file, via any medium is strictly prohibited.
// Proprietary and confidential.
////////////////////////////////////////////////////////////////////////////////
#include "LogUtil.h"
G
groot 已提交
7
#include "server/ServerConfig.h"
G
groot 已提交
8 9

#include <easylogging++.h>
G
groot 已提交
10
#include <ctype.h>
G
groot 已提交
11 12 13 14 15 16

namespace zilliz {
namespace vecwise {
namespace server {

int32_t InitLog() {
G
groot 已提交
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
#if 0
    ServerConfig &config = ServerConfig::GetInstance();
    ConfigNode log_config = config.GetConfig(CONFIG_LOG);
    const std::map<std::string, ConfigNode>& settings = log_config.GetChildren();

    std::string str_config;
    for(auto iter : settings) {
        str_config += "* ";
        str_config += iter.first;
        str_config += ":";
        str_config.append("\n");

        auto sub_configs = iter.second.GetConfig();
        for(auto it_sub : sub_configs) {
            str_config += "    ";
            str_config += it_sub.first;
            str_config += " = ";
            std::string temp = it_sub.first;
            std::transform(temp.begin(), temp.end(), temp.begin(), ::tolower);
            bool is_text = (temp == "format" || temp == "filename");
            if(is_text){
                str_config += "\"";
            }
            str_config += it_sub.second;
            if(is_text){
                str_config += "\"";
            }
            str_config.append("\n");
        }
    }

    el::Configurations conf;
    conf.parseFromText(str_config);
#else
G
groot 已提交
51
    el::Configurations conf("../../conf/vecwise_engine_log.conf");
G
groot 已提交
52
#endif
G
groot 已提交
53

G
groot 已提交
54
    el::Loggers::reconfigureAllLoggers(conf);
G
groot 已提交
55 56 57 58 59 60 61
    return 0;
}


}   // server
}   // vecwise
}   // zilliz