Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc request: how to retrieve / print logs? #290

Closed
rebcabin opened this issue Jul 2, 2014 · 3 comments
Closed

Doc request: how to retrieve / print logs? #290

rebcabin opened this issue Jul 2, 2014 · 3 comments

Comments

@rebcabin
Copy link

rebcabin commented Jul 2, 2014

It's not clear how to access the buffers created by INFO and other logging mechanisms. Please see this stackoverflow question: http://bit.ly/1mJUoS0.

@rebcabin
Copy link
Author

rebcabin commented Jul 2, 2014

The following is a tiny MVP of something that does not work; about as far as I could get reading the source. I stalled at line 1559, where the code refers to scopedMessage, and I could not find a definition of that anywhere ... seems some deeper magic is happening.

#include <stdio.h>
#include <iostream>

#define CATCH_CONFIG_RUNNER
#include "catch.hpp"
using namespace std;

struct some_struct
{
    uint64_t timestamp;
    double lat;
    double lon;
    float alt;
};

TEST_CASE ("sizes", "[metadata]" ) {
    INFO ( "The number is " << 42 );
    REQUIRE (sizeof(some_struct) == 32);
}

int
main (int argc, char ** const argv) {
    int result = Catch::Session().run( argc, argv );
    // cout << Catch::MessageBuilder::m_stream;
    return result;
}

@martinmoene
Copy link
Collaborator

The INFO information is reported on failure (and with option --success), not on success (Catch streaming macros).

prompt>g++ -ICatch/single_include -o info.exe info.cpp & info.exe -r compact
info.cpp:18: failed: sizeof(some_struct) == 33 for: 32 == 33 with 1 message: 'The number is 42'
Failed 1 test case, failed 1 assertion.

cheers,
Martin

@rebcabin
Copy link
Author

rebcabin commented Jul 2, 2014

Ok, thanks for the clarification!

@rebcabin rebcabin closed this as completed Jul 2, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants