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 <cstdint> |
12 | #include <cstdio> |
13 | #include <string> |
14 | |
15 | #include "port/port.h" |
16 | |
17 | namespace leveldb { |
18 | |
19 | class Slice; |
20 | class WritableFile; |
21 | |
22 | // Append a human-readable printout of "num" to *str |
23 | void AppendNumberTo(std::string* str, uint64_t num); |
24 | |
25 | // Append a human-readable printout of "value" to *str. |
26 | // Escapes any non-printable characters found in "value". |
27 | void AppendEscapedStringTo(std::string* str, const Slice& value); |
28 | |
29 | // Return a human-readable printout of "num" |
30 | std::string NumberToString(uint64_t num); |
31 | |
32 | // Return a human-readable version of "value". |
33 | // Escapes any non-printable characters found in "value". |
34 | std::string EscapeString(const Slice& value); |
35 | |
36 | // Parse a human-readable number from "*in" into *value. On success, |
37 | // advances "*in" past the consumed number and sets "*val" to the |
38 | // numeric value. Otherwise, returns false and leaves *in in an |
39 | // unspecified state. |
40 | bool ConsumeDecimalNumber(Slice* in, uint64_t* val); |
41 | |
42 | } // namespace leveldb |
43 | |
44 | #endif // STORAGE_LEVELDB_UTIL_LOGGING_H_ |
45 | |