~kgunn72/mir/dont-crash-when-shooting-invalid-surface

« back to all changes in this revision

Viewing changes to src/shared/logging/dumb_console_logger.cpp

  • Committer: Tarmac
  • Author(s): Alan Griffiths, Alexandros Frantzis, Daniel van Vugt, Kevin DuBois, Christopher James Halse Rogers, chris.gagnon, Mathieu Trudel-Lapierre, Robert Carr, Automatic PS uploader, Kevin Gunn, Daniel d'Andrada, Christopher James Halse Rogers, Michael Terry, Brandon Schaefer, Timo Jyrinki, Mir Team, Andreas Pokorny
  • Date: 2013-12-20 11:11:22 UTC
  • mfrom: (1169.1.1 version-0.1.3)
  • Revision ID: tarmac-20131220111122-h503fd1fnq7pn9za
Latest upstream release: Mir 0.1.3 (r1298).

Approved by Alan Griffiths, PS Jenkins bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#include "mir/logging/dumb_console_logger.h"
20
20
 
21
21
#include <iostream>
 
22
#include <ctime>
 
23
#include <cstdio>
22
24
 
23
25
namespace ml = mir::logging;
24
26
 
38
40
 
39
41
    std::ostream& out = severity < Logger::informational ? std::cerr : std::cout;
40
42
 
41
 
    out << "[" << lut[severity] << ", " << component << "] "
42
 
        << message << "\n";
 
43
    struct timespec ts;
 
44
    clock_gettime(CLOCK_REALTIME, &ts);
 
45
    char now[32];
 
46
    snprintf(now, sizeof(now), "%ld.%06ld",
 
47
             (long)ts.tv_sec, ts.tv_nsec / 1000);
 
48
 
 
49
    out << "["
 
50
        << now
 
51
        << "] ("
 
52
        << lut[severity]
 
53
        << ") "
 
54
        << component
 
55
        << ": "
 
56
        << message
 
57
        << "\n";
43
58
}