File: prog.cpp

package info (click to toggle)
easyloggingpp 9.97.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 2,840 kB
  • sloc: cpp: 11,415; python: 2,336; sh: 337; makefile: 29
file content (28 lines) | stat: -rw-r--r-- 990 bytes parent folder | download | duplicates (6)
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

#include "easylogging++.h"
#include "mymath.h"

INITIALIZE_EASYLOGGINGPP

TIMED_SCOPE(benchmark, "benchmark-program");

int main(int argc, char *argv[])
{
    // ELPP_INITIALIZE_SYSLOG("my_proc", LOG_PID | LOG_CONS | LOG_PERROR, LOG_USER);
    el::Loggers::reconfigureAllLoggers(el::ConfigurationType::ToStandardOutput, "false");
    TIMED_BLOCK(loggingPerformance, "benchmark-block") {
        el::base::SubsecondPrecision ssPrec(3);
        std::cout << "Starting program " << el::base::utils::DateTime::getDateTime("%h:%m:%s", &ssPrec) << std::endl;
        int MAX_LOOP = 1000000;
        for (int i = 0; i <= MAX_LOOP; ++i) {
            LOG(INFO) << "Log message " << i;
        }
        int result = MyMath::sum(1, 2);
        result = MyMath::sum(1, 3);

        std::cout << "Finished program - cleaning! " << el::base::utils::DateTime::getDateTime("%h:%m:%s", &ssPrec) << std::endl;
    }
    // SYSLOG(INFO) << "This is syslog - read it from /var/log/syslog";

    return 0;
}