• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nasa / trick / 21297863321

23 Jan 2026 07:04PM UTC coverage: 55.61% (-0.01%) from 55.623%
21297863321

push

github

web-flow
Frame log choose buffering (#2031)

* Update frame logging to accept alternate buffering schemes.

* Moved functionality from c interface function to cpp, and made available to input processor

* Remove extra unnecessary include

8 of 9 new or added lines in 1 file covered. (88.89%)

2 existing lines in 2 files now uncovered.

12510 of 22496 relevant lines covered (55.61%)

291537.86 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

96.97
/trick_source/sim_services/Message/MessageCout.cpp
1

2
#include "trick/MessageCout.hh"
3
#include "trick/message_type.h"
4

5
#include <sstream>
6

7
Trick::MessageCout::MessageCout() {
215✔
8
    /** By default, this subscriber is enabled when it is created. */
9
    enabled = 1 ;
215✔
10
    color = 1 ;
215✔
11
    name = "cout" ;
215✔
12
}
215✔
13

14
void Trick::MessageCout::update( unsigned int level , std::string header , std::string message ) {
33,667✔
15

16
    /** @par Design Details: */
17
    std::string color_code ;
67,334✔
18

19
    switch (level) {
33,667✔
20
        case MSG_NORMAL :
1,940✔
21
            color_code = "\033[00m" ; // normal
1,940✔
22
            break ;
1,940✔
23
        case MSG_INFO :
67✔
24
            color_code = "\033[32m" ; // green
67✔
25
            break ;
67✔
26
        case MSG_WARNING :
13✔
27
            color_code = "\033[33m" ; // yellow
13✔
28
            break ;
13✔
29
        case MSG_ERROR :
26✔
30
            color_code = "\033[31m" ; // red
26✔
31
            break ;
26✔
32
        case MSG_DEBUG :
357✔
33
            color_code = "\033[36m" ; // cyan
357✔
34
            break ;
357✔
35
        default :
31,264✔
36
            color_code = "\033[00m" ; // normal
31,264✔
37
            break ;
31,264✔
38
    }
39

40
    /** @li Prints the received message to the standard output stream. */
41
    if (enabled && level < 100 ) {
33,667✔
42

43
        // Building the final string in a temporary stream ensures an automic call to cout, which prevents
44
        // multithreaded sims from interleaving header and message elements.
45
        std::ostringstream oss;
33,667✔
46
        if ( color ) {
33,667✔
47
            oss << header << color_code << message << "\033[00m" ;
33,667✔
48
        } else {
UNCOV
49
            oss << header << message ;
×
50
        }
51
        std::cout << oss.str() << std::flush;
33,667✔
52
    }
53
}
33,667✔
54

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc