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 37 38 39 40 41 42
|
/*
* SPDX-FileCopyrightText: 2017-2017 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*
*/
#include <iostream>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#include "fcitx-utils/log.h"
int main() {
int a = 0;
fcitx::Log::setLogRule("*=5");
FCITX_INFO() << (a = 1);
FCITX_ASSERT(a == 1);
fcitx::Log::setLogRule("*=4");
FCITX_DEBUG() << (a = 2);
FCITX_ASSERT(a == 1);
std::vector<int> vec{1, 2, 3};
FCITX_INFO() << vec;
std::unordered_map<int, int> map{{1, 1}, {2, 3}};
FCITX_INFO() << map;
FCITX_INFO() << std::make_tuple(1, 3, "a", false);
std::stringstream s;
fcitx::Log::setLogStream(s);
FCITX_INFO() << "ABCD";
fcitx::Log::setLogStream(std::cerr);
FCITX_ASSERT(s.str().find("ABCD") != std::string::npos);
return 0;
}
|