Blame src/logging_striptest_main.cc

Packit Service 9def5d
// Copyright (c) 2007, Google Inc.
Packit Service 9def5d
// All rights reserved.
Packit Service 9def5d
//
Packit Service 9def5d
// Redistribution and use in source and binary forms, with or without
Packit Service 9def5d
// modification, are permitted provided that the following conditions are
Packit Service 9def5d
// met:
Packit Service 9def5d
//
Packit Service 9def5d
//     * Redistributions of source code must retain the above copyright
Packit Service 9def5d
// notice, this list of conditions and the following disclaimer.
Packit Service 9def5d
//     * Redistributions in binary form must reproduce the above
Packit Service 9def5d
// copyright notice, this list of conditions and the following disclaimer
Packit Service 9def5d
// in the documentation and/or other materials provided with the
Packit Service 9def5d
// distribution.
Packit Service 9def5d
//     * Neither the name of Google Inc. nor the names of its
Packit Service 9def5d
// contributors may be used to endorse or promote products derived from
Packit Service 9def5d
// this software without specific prior written permission.
Packit Service 9def5d
//
Packit Service 9def5d
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
Packit Service 9def5d
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
Packit Service 9def5d
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
Packit Service 9def5d
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
Packit Service 9def5d
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
Packit Service 9def5d
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
Packit Service 9def5d
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
Packit Service 9def5d
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
Packit Service 9def5d
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
Packit Service 9def5d
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Packit Service 9def5d
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Packit Service 9def5d
//
Packit Service 9def5d
// Author: Sergey Ioffe
Packit Service 9def5d
Packit Service 9def5d
// The common part of the striplog tests.
Packit Service 9def5d
Packit Service 9def5d
#include <stdio.h>
Packit Service 9def5d
#include <string>
Packit Service 9def5d
#include <iosfwd>
Packit Service 9def5d
#include "glog/logging.h"
Packit Service 9def5d
#include "base/commandlineflags.h"
Packit Service 9def5d
#include "config.h"
Packit Service 9def5d
Packit Service 9def5d
DECLARE_bool(logtostderr);
Packit Service 9def5d
GLOG_DEFINE_bool(check_mode, false, "Prints 'opt' or 'dbg'");
Packit Service 9def5d
Packit Service 9def5d
using std::string;
Packit Service 9def5d
using namespace GOOGLE_NAMESPACE;
Packit Service 9def5d
Packit Service 9def5d
int CheckNoReturn(bool b) {
Packit Service 9def5d
  string s;
Packit Service 9def5d
  if (b) {
Packit Service 9def5d
    LOG(FATAL) << "Fatal";
Packit Service 9def5d
  } else {
Packit Service 9def5d
    return 0;
Packit Service 9def5d
  }
Packit Service 9def5d
}
Packit Service 9def5d
Packit Service 9def5d
struct A { };
Packit Service 9def5d
std::ostream &operator<<(std::ostream &str, const A&) {return str;}
Packit Service 9def5d
Packit Service 9def5d
int main(int, char* argv[]) {
Packit Service 9def5d
  FLAGS_logtostderr = true;
Packit Service 9def5d
  InitGoogleLogging(argv[0]);
Packit Service 9def5d
  if (FLAGS_check_mode) {
Packit Service 9def5d
    printf("%s\n", DEBUG_MODE ? "dbg" : "opt");
Packit Service 9def5d
    return 0;
Packit Service 9def5d
  }
Packit Service 9def5d
  LOG(INFO) << "TESTMESSAGE INFO";
Packit Service 9def5d
  LOG(WARNING) << 2 << "something" << "TESTMESSAGE WARNING"
Packit Service 9def5d
               << 1 << 'c' << A() << std::endl;
Packit Service 9def5d
  LOG(ERROR) << "TESTMESSAGE ERROR";
Packit Service 9def5d
  bool flag = true;
Packit Service 9def5d
  (flag ? LOG(INFO) : LOG(ERROR)) << "TESTMESSAGE COND";
Packit Service 9def5d
  LOG(FATAL) << "TESTMESSAGE FATAL";
Packit Service 9def5d
}