Google Cloud C++ Client 2.10.1
C++ Client Library for Google Cloud Platform
Loading...
Searching...
No Matches
tracing_options.h
1// Copyright 2020 Google LLC
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// https://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#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_TRACING_OPTIONS_H
16#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_TRACING_OPTIONS_H
17
18#include "google/cloud/version.h"
19#include <cstdint>
20#include <string>
21
22namespace google {
23namespace cloud {
25/**
26 * The configuration parameters for RPC/protobuf tracing.
27 *
28 * The default options are:
29 * single_line_mode=on
30 * use_short_repeated_primitives=on
31 * truncate_string_field_longer_than=128
32 */
33class TracingOptions {
34 public:
35 TracingOptions() = default;
36 TracingOptions(TracingOptions const&) = default;
37 TracingOptions& operator=(TracingOptions const&) = default;
38 TracingOptions(TracingOptions&&) = default;
40
41 friend bool operator==(TracingOptions const& a, TracingOptions const& b);
42 friend bool operator!=(TracingOptions const& a, TracingOptions const& b) {
43 return !(a == b);
44 }
45
46 /// Override the default options with values from @p `str`.
47 TracingOptions& SetOptions(std::string const& str);
48
49 /// The entire message will be output on a single line with no line breaks.
50 bool single_line_mode() const { return single_line_mode_; }
51
52 /// Print repeated primitives in a compact format instead of each value on
53 /// its own line.
55 return use_short_repeated_primitives_;
56 }
57
58 /// If non-zero, truncate all string/bytes fields longer than this.
60 return truncate_string_field_longer_than_;
61 }
62
63 private:
64 bool single_line_mode_ = true;
65 bool use_short_repeated_primitives_ = true;
66 std::int64_t truncate_string_field_longer_than_ = 128;
67};
68
70} // namespace cloud
71} // namespace google
72
73#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_TRACING_OPTIONS_H
The configuration parameters for RPC/protobuf tracing.
Definition: tracing_options.h:33
friend bool operator==(TracingOptions const &a, TracingOptions const &b)
TracingOptions(TracingOptions const &)=default
std::int64_t truncate_string_field_longer_than() const
If non-zero, truncate all string/bytes fields longer than this.
Definition: tracing_options.h:59
bool single_line_mode() const
The entire message will be output on a single line with no line breaks.
Definition: tracing_options.h:50
friend bool operator!=(TracingOptions const &a, TracingOptions const &b)
Definition: tracing_options.h:42
bool use_short_repeated_primitives() const
Print repeated primitives in a compact format instead of each value on its own line.
Definition: tracing_options.h:54
TracingOptions & SetOptions(std::string const &str)
Override the default options with values from `str`.
TracingOptions & operator=(TracingOptions const &)=default
TracingOptions(TracingOptions &&)=default
TracingOptions & operator=(TracingOptions &&)=default
Contains all the Google Cloud C++ Library APIs.
Definition: async_operation.h:23
Definition: async_operation.h:22
#define GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Definition: version.h:45
#define GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
Definition: version.h:43