pombreda / google-glog

Automatically exported from code.google.com/p/google-glog
Other
0 stars 0 forks source link

Check failur stack trace Message #85

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. LOG(FATAL) << "fatal";
2.
3.

What is the expected output? What do you see instead?
shutdown the logger 

What version of the product are you using? On what operating system?

O.S : Windows 7  (32bit)
visual studio 2010

Please provide any additional information below.

#include "stdafx.h"
#include <glog/logging.h>

using namespace google;
using namespace std;

struct NullLogger : public base::Logger {
  virtual void Write(bool should_flush,
                     time_t timestamp,
                     const char* message,
                     int length) {
  }

  virtual void Flush() { }

  virtual uint32 LogSize() { return 0; }
};

void SetMyLogger(int severity, base::Logger* logger)
{
  base::Logger* old_logger = base::GetLogger(severity);
  base::SetLogger(severity, logger);
  FlushLogFiles(severity);
}

int _tmain(int argc, _TCHAR* argv[])
{

  InitGoogleLogging(argv[0]);

  NullLogger null_logger;

  SetLogDestination(INFO, "c:\\temp\\aa.log"); 

  SetMyLogger(WARNING, &null_logger);
  SetMyLogger(ERROR, &null_logger);
  SetMyLogger(FATAL, &null_logger);

  LOG(INFO) << "info";
  LOG(WARNING) << "warn";
  LOG(ERROR) << "error1";
  LOG(ERROR) << "error2";
  LOG(ERROR) << "error3";
  LOG(FATAL) << "fatal";   <----- "Check failur stack trace" Message
                           <----- shutdown the logger 

    return 0;

}

Original issue reported on code.google.com by ctm...@gmail.com on 13 Apr 2011 at 1:58