File: main.cxx

package info (click to toggle)
log4cplus 2.0.5-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 10,560 kB
  • sloc: cpp: 46,669; sh: 10,310; ansic: 1,845; python: 1,114; perl: 258; makefile: 214; xml: 85; objc: 59
file content (68 lines) | stat: -rw-r--r-- 1,844 bytes parent folder | download | duplicates (3)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include <log4cplus/helpers/timehelper.h>
#include <log4cplus/streams.h>
#include <log4cplus/logger.h>
#include <log4cplus/initializer.h>
#include <iostream>

using namespace log4cplus;
using namespace log4cplus::helpers;


log4cplus::tchar const fmtstr[] =
    LOG4CPLUS_TEXT("%s, %Q%%q%q %%Q %%q=%%%q%%;%%q, %%Q=%Q");


int
main()
{
    std::cout << "Entering main()..." << std::endl;
    log4cplus::Initializer initializer;
    try
    {
        Time time;
        log4cplus::tstring str;

        time = now ();
        str = getFormattedTime (fmtstr, time);
        log4cplus::tcout << LOG4CPLUS_TEXT ("now: ") << str << std::endl;

        time = time_from_parts (0, 7);
        str = getFormattedTime (fmtstr, time);
        log4cplus::tcout << str << std::endl;

        time = time_from_parts (0, 17);
        str = getFormattedTime (fmtstr, time);
        log4cplus::tcout << str << std::endl;

        time = time_from_parts (0, 123);
        str = getFormattedTime (fmtstr, time);
        log4cplus::tcout << str << std::endl;

        time = time_from_parts (0, 1234);
        str = getFormattedTime (fmtstr, time);
        log4cplus::tcout << str << std::endl;

        time = time_from_parts (0, 12345);
        str = getFormattedTime (fmtstr, time);
        log4cplus::tcout << str << std::endl;

        time = time_from_parts (0, 123456);
        str = getFormattedTime (fmtstr, time);
        log4cplus::tcout << str << std::endl;

        time = time_from_parts (0, 0);
        str = getFormattedTime (fmtstr, time);
        log4cplus::tcout << str << std::endl;
    }
    catch(std::exception const & e)
    {
        std::cout << "Exception: " << e.what () << std::endl;
    }
    catch(...)
    {
        std::cout << "Exception..." << std::endl;
    }

    std::cout << "Exiting main()..." << std::endl;
    return 0;
}