-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
26 lines (23 loc) · 912 Bytes
/
main.cpp
File metadata and controls
26 lines (23 loc) · 912 Bytes
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
#include <iostream>
#include <fstream>
#define LOGGING_EXTRA_DEFINES
#include "logging/logging.h"
int main()
{
// With defines
std::ofstream ofs("test.log");
_INFO_.addStream(&ofs);
_INFO_.addStream(&std::cout);
_INFO_ << "This string of text will apear on both std::cout and in test.log file";
_INFO_.removeStream(&std::cout);
_INFO_ << "This string of text will only appear in test.log file";
// Without defines
/*
std::ofstream ofs("test.log");
Logger::getLogger(LogLevel::LOG_INFO).addStream(&ofs);
Logger::getLogger(LogLevel::LOG_INFO).addStream(&std::cout);
Logger::getLogger(LogLevel::LOG_INFO) << "This string of text will apear on both std::cout and in test.log file";
Logger::getLogger(LogLevel::LOG_INFO).removeStream(&std::cout);
Logger::getLogger(LogLevel::LOG_INFO) << "This string of text will only appear in test.log file";
*/
}