roughtime.googlesource.com/roughtime.git@v0.0.0-20201210012726-dd529367052d/logging.h (about)

     1  /* Copyright 2017 The Roughtime Authors.
     2   *
     3   * Licensed under the Apache License, Version 2.0 (the "License");
     4   * you may not use this file except in compliance with the License.
     5   * You may obtain a copy of the License at
     6   *
     7   *   http://www.apache.org/licenses/LICENSE-2.0
     8   *
     9   * Unless required by applicable law or agreed to in writing, software
    10   * distributed under the License is distributed on an "AS IS" BASIS,
    11   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12   * See the License for the specific language governing permissions and
    13   * limitations under the License. */
    14  
    15  
    16  #ifndef ROUGHTIME_LOGGER_H_
    17  #define ROUGHTIME_LOGGER_H_
    18  
    19  #if defined(USE_GLOG)
    20  #include <glog/logging.h>
    21  
    22  #define GLOG_logtostderr 1
    23  #define ROUGHTIME_LOG LOG
    24  #define ROUGHTIME_LOG_IF LOG_IF
    25  
    26  #define ROUGHTIME_CHECK CHECK
    27  
    28  #define ROUGHTIME_CHECK_EQ CHECK_EQ
    29  #define ROUGHTIME_CHECK_NE CHECK_NE
    30  #define ROUGHTIME_CHECK_LT CHECK_LT
    31  #define ROUGHTIME_CHECK_LE CHECK_LE
    32  #define ROUGHTIME_CHECK_GT CHECK_GT
    33  #define ROUGHTIME_CHECK_GE CHECK_GE
    34  
    35  #define ROUGHTIME_DLOG DLOG
    36  #define ROUGHTIME_DCHECK    DCHECK
    37  #define ROUGHTIME_DCHECK_OK DCHECK_OK
    38  #define ROUGHTIME_DCHECK_EQ DCHECK_EQ
    39  #define ROUGHTIME_DCHECK_NE DCHECK_NE
    40  #define ROUGHTIME_DCHECK_LT DCHECK_LT
    41  #define ROUGHTIME_DCHECK_LE DCHECK_LE
    42  #define ROUGHTIME_DCHECK_GT DCHECK_GT
    43  #define ROUGHTIME_DCHECK_GE DCHECK_GE
    44  
    45  #define ROUGHTIME_INIT_LOGGER  google::InitGoogleLogging
    46  
    47  #else
    48  #include <google/protobuf/stubs/logging.h>
    49  #include <google/protobuf/stubs/macros.h>
    50  
    51  #define ROUGHTIME_LOG GOOGLE_LOG
    52  #define ROUGHTIME_LOG_IF GOOGLE_LOG_IF
    53  
    54  #define ROUGHTIME_CHECK GOOGLE_CHECK
    55  
    56  #define ROUGHTIME_CHECK_EQ GOOGLE_CHECK_EQ
    57  #define ROUGHTIME_CHECK_NE GOOGLE_CHECK_NE
    58  #define ROUGHTIME_CHECK_LT GOOGLE_CHECK_LT
    59  #define ROUGHTIME_CHECK_LE GOOGLE_CHECK_LE
    60  #define ROUGHTIME_CHECK_GT GOOGLE_CHECK_GT
    61  #define ROUGHTIME_CHECK_GE GOOGLE_CHECK_GE
    62  
    63  #define ROUGHTIME_DLOG GOOGLE_DLOG
    64  #define ROUGHTIME_DCHECK    GOOGLE_DCHECK
    65  #define ROUGHTIME_DCHECK_OK GOOGLE_DCHECK_OK
    66  #define ROUGHTIME_DCHECK_EQ GOOGLE_DCHECK_EQ
    67  #define ROUGHTIME_DCHECK_NE GOOGLE_DCHECK_NE
    68  #define ROUGHTIME_DCHECK_LT GOOGLE_DCHECK_LT
    69  #define ROUGHTIME_DCHECK_LE GOOGLE_DCHECK_LE
    70  #define ROUGHTIME_DCHECK_GT GOOGLE_DCHECK_GT
    71  #define ROUGHTIME_DCHECK_GE GOOGLE_DCHECK_GE
    72  #define ROUGHTIME_INIT_LOGGER(a)
    73  #endif
    74  
    75  #endif