logging.h raw

   1  // Copyright (c) 2011 The LevelDB Authors. All rights reserved.
   2  // Use of this source code is governed by a BSD-style license that can be
   3  // found in the LICENSE file. See the AUTHORS file for names of contributors.
   4  //
   5  // Must not be included from any .h files to avoid polluting the namespace
   6  // with macros.
   7  
   8  #ifndef STORAGE_LEVELDB_UTIL_LOGGING_H_
   9  #define STORAGE_LEVELDB_UTIL_LOGGING_H_
  10  
  11  #include <stdint.h>
  12  #include <stdio.h>
  13  
  14  #include <string>
  15  
  16  #include "port/port.h"
  17  
  18  namespace leveldb {
  19  
  20  class Slice;
  21  class WritableFile;
  22  
  23  // Append a human-readable printout of "num" to *str
  24  void AppendNumberTo(std::string* str, uint64_t num);
  25  
  26  // Append a human-readable printout of "value" to *str.
  27  // Escapes any non-printable characters found in "value".
  28  void AppendEscapedStringTo(std::string* str, const Slice& value);
  29  
  30  // Return a human-readable printout of "num"
  31  std::string NumberToString(uint64_t num);
  32  
  33  // Return a human-readable version of "value".
  34  // Escapes any non-printable characters found in "value".
  35  std::string EscapeString(const Slice& value);
  36  
  37  // Parse a human-readable number from "*in" into *value.  On success,
  38  // advances "*in" past the consumed number and sets "*val" to the
  39  // numeric value.  Otherwise, returns false and leaves *in in an
  40  // unspecified state.
  41  bool ConsumeDecimalNumber(Slice* in, uint64_t* val);
  42  
  43  }  // namespace leveldb
  44  
  45  #endif  // STORAGE_LEVELDB_UTIL_LOGGING_H_
  46