Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8886613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:36:03+00:00 2026-06-14T21:36:03+00:00

I was looking at glog ‘s documentation and got confused at the way the

  • 0

I was looking at glog‘s documentation and got confused at the way the stream operator is being used.

LOG(INFO) << "Found " << num_cookies << " cookies";

How can it deduce that all those calls are to form a single log message?

From my understanding, this:

cout << foo << bar << baz;

is equivalent to:

cout << foo;
cout << bar;
cout << baz;

How is it able to group together the chained calls like that without a special delimiter?

EDIT:

I know that you can chain them and why is works, that was not my question.
I’m asking how glog can take

LOG(INFO) << "Found " << num_cookies << " cookies";

what looks to me like 3 separate calls to the << overload and know that

"Found 3 cookies"

is a single log message as opposed to 3.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T21:36:04+00:00Added an answer on June 14, 2026 at 9:36 pm

    cout << foo returns cout

    So it then becomes
    cout << bar << baz;

    and so on.

    Another way to see it clearer is

    ((cout.operator<<(foo)).operator<<(bar)).operator<<(baz);

    which is exactly what is happening

    You can see this from http://www.cplusplus.com/reference/ostream/ostream/operator%3C%3C/

    ostream& operator<< (double val);

    Edit

    After the discussion, it appears that the question is more about how gLogs seperate each log into its own log entry without a terminator or any endl type object.

    It appears from glancing over logging.h, that each individual log might be written by a different stream object.

    #define PLOG(severity) GOOGLE_PLOG(severity, 0).stream()
    

    This means that while using the same log object, you write to the same log entry. And every other call to Log actually creates a new stream object. RAII will take care of actually writing the finished log, as this is a temporary object and it is destroyed after the line of code is executed.

    I would need to go deeper into the code to understand better but it looks like this is an accurate if brief answer. The question remains if (and if so how) this is optimized..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Looking through the Symfony documentation, I found a way to secure a form with
Looking for a way to not have a publicly hosted video be used in
Looking for a way to get path of file (and then process it in
Looking at the documentation of DialogFragment , one sees the static newInstance method to
Looking for more detailed info on how to read the NAL header and more
Looking for a way to capture user password in case of Tomcat form-based authentication
Looking through the documentation , it seems that the new advanced gestures API doesn't
Looking for a way to add a background layer to existing photoshop files with
Looking for a way, how to get the values from a hash, in an
Looking for a way to detect finger gestures in my Windows Mobile applications. Main

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.