2011-03-18 22:37:00 +00:00
|
|
|
// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file. See the AUTHORS file for names of contributors.
|
|
|
|
//
|
|
|
|
// Must not be included from any .h files to avoid polluting the namespace
|
|
|
|
// with macros.
|
|
|
|
|
|
|
|
#ifndef STORAGE_LEVELDB_UTIL_LOGGING_H_
|
|
|
|
#define STORAGE_LEVELDB_UTIL_LOGGING_H_
|
|
|
|
|
2020-04-29 19:59:39 +00:00
|
|
|
#include <cstdint>
|
|
|
|
#include <cstdio>
|
2011-03-18 22:37:00 +00:00
|
|
|
#include <string>
|
2019-05-02 11:01:00 -07:00
|
|
|
|
2011-03-18 22:37:00 +00:00
|
|
|
#include "port/port.h"
|
|
|
|
|
|
|
|
namespace leveldb {
|
|
|
|
|
|
|
|
class Slice;
|
|
|
|
class WritableFile;
|
|
|
|
|
|
|
|
// Append a human-readable printout of "num" to *str
|
2018-03-12 09:14:44 -07:00
|
|
|
void AppendNumberTo(std::string* str, uint64_t num);
|
2011-03-18 22:37:00 +00:00
|
|
|
|
|
|
|
// Append a human-readable printout of "value" to *str.
|
|
|
|
// Escapes any non-printable characters found in "value".
|
2018-03-12 09:14:44 -07:00
|
|
|
void AppendEscapedStringTo(std::string* str, const Slice& value);
|
2011-03-18 22:37:00 +00:00
|
|
|
|
|
|
|
// Return a human-readable printout of "num"
|
2018-03-12 09:14:44 -07:00
|
|
|
std::string NumberToString(uint64_t num);
|
2011-03-18 22:37:00 +00:00
|
|
|
|
|
|
|
// Return a human-readable version of "value".
|
|
|
|
// Escapes any non-printable characters found in "value".
|
2018-03-12 09:14:44 -07:00
|
|
|
std::string EscapeString(const Slice& value);
|
2011-03-18 22:37:00 +00:00
|
|
|
|
|
|
|
// Parse a human-readable number from "*in" into *value. On success,
|
|
|
|
// advances "*in" past the consumed number and sets "*val" to the
|
|
|
|
// numeric value. Otherwise, returns false and leaves *in in an
|
|
|
|
// unspecified state.
|
2018-03-12 09:14:44 -07:00
|
|
|
bool ConsumeDecimalNumber(Slice* in, uint64_t* val);
|
2011-03-18 22:37:00 +00:00
|
|
|
|
2011-10-31 17:22:06 +00:00
|
|
|
} // namespace leveldb
|
2011-03-18 22:37:00 +00:00
|
|
|
|
|
|
|
#endif // STORAGE_LEVELDB_UTIL_LOGGING_H_
|