aboutsummaryrefslogtreecommitdiffstats
path: root/vespalog/src/test/simple/logtest.cpp
blob: b543f1f755dba86db254deb0f1ed09e2eb7d8962 (plain) (blame)
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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <sys/types.h>
#include <stdlib.h>
#include <unistd.h>
#include <csignal>

#include <vespa/log/log.h>

LOG_SETUP("logtest",
          "$Id: logtest.cpp 119439 2011-04-19 09:32:27Z arnej $");

int
main(int, char **argv)
{
    EV_STARTING("logtest");
    LOG(info, "Starting up, called as %s", argv[0]);
    EV_STARTED("logtest");
    EV_CRASH("something", getpid(), SIGTERM);
    EV_PROGRESS("batch-index", 7, 100);
    EV_PROGRESS("unbounded-batch-index", 9);
    EV_COUNT("hits", 3);
    EV_VALUE("some value", 1./3);

    LOG(info, "backslash: \\");
    int n;
    LOG(info, "Will log 20 spam messages now every 50ms");
    for (n = 1; n <= 5; n++) {
        LOG(spam, "log message %d/%d", n, 100);
        usleep(50000);
    }
    LOG(info, "Exiting.");
    EV_STOPPING("logtest", "clean exit");
    EV_STOPPED("logtest", getpid(), 0);
    return EXIT_SUCCESS;
}