aboutsummaryrefslogtreecommitdiff
path: root/webrtc/system_wrappers/include/trace.h
diff options
context:
space:
mode:
authorChih-hung Hsieh <chh@google.com>2015-12-01 17:07:48 +0000
committerandroid-build-merger <android-build-merger@google.com>2015-12-01 17:07:48 +0000
commita4acd9d6bc9b3b033d7d274316e75ee067df8d20 (patch)
tree672a185b294789cf991f385c3e395dd63bea9063 /webrtc/system_wrappers/include/trace.h
parent3681b90ba4fe7a27232dd3e27897d5d7ed9d651c (diff)
parentfe8b4a657979b49e1701bd92f6d5814a99e0b2be (diff)
downloadwebrtc-a4acd9d6bc9b3b033d7d274316e75ee067df8d20.tar.gz
Merge changes I7bbf776e,I1b827825
am: fe8b4a6579 * commit 'fe8b4a657979b49e1701bd92f6d5814a99e0b2be': (7237 commits) WIP: Changes after merge commit 'cb3f9bd' Make the nonlinear beamformer steerable Utilize bitrate above codec max to protect video. Enable VP9 internal resize by default. Filter overlapping RTP header extensions. Make VCMEncodedFrameCallback const. MediaCodecVideoEncoder: Add number of quality resolution downscales to Encoded callback. Remove redudant encoder rate calls. Create isolate files for nonparallel tests. Register header extensions in RtpRtcpObserver to avoid log spam. Make an enum class out of NetEqDecoder, and hide the neteq_decoders_ table ACM: Move NACK functionality inside NetEq Fix chromium-style warnings in webrtc/sound/. Create a 'webrtc_nonparallel_tests' target. Update scalability structure data according to updates in the RTP payload profile. audio_coding: rename interface -> include Rewrote perform_action_on_all_files to be parallell. Update reference indices according to updates in the RTP payload profile. Disable P2PTransport...TestFailoverControlledSide on Memcheck pass clangcl compile options to ignore warnings in gflags.cc ...
Diffstat (limited to 'webrtc/system_wrappers/include/trace.h')
-rw-r--r--webrtc/system_wrappers/include/trace.h92
1 files changed, 92 insertions, 0 deletions
diff --git a/webrtc/system_wrappers/include/trace.h b/webrtc/system_wrappers/include/trace.h
new file mode 100644
index 0000000000..e63b603d1b
--- /dev/null
+++ b/webrtc/system_wrappers/include/trace.h
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ *
+ * System independent wrapper for logging runtime information to file.
+ * Note: All log messages will be written to the same trace file.
+ * Note: If too many messages are written to file there will be a build up of
+ * messages. Apply filtering to avoid that.
+ */
+
+#ifndef WEBRTC_SYSTEM_WRAPPERS_INTERFACE_TRACE_H_
+#define WEBRTC_SYSTEM_WRAPPERS_INTERFACE_TRACE_H_
+
+#include "webrtc/common_types.h"
+#include "webrtc/typedefs.h"
+
+namespace webrtc {
+
+#if defined(WEBRTC_RESTRICT_LOGGING)
+// Disable all TRACE macros. The LOG macro is still functional.
+#define WEBRTC_TRACE true ? (void) 0 : Trace::Add
+#else
+#define WEBRTC_TRACE Trace::Add
+#endif
+
+class Trace {
+ public:
+ // The length of the trace text preceeding the log message.
+ static const int kBoilerplateLength;
+ // The position of the timestamp text within a trace.
+ static const int kTimestampPosition;
+ // The length of the timestamp (without "delta" field).
+ static const int kTimestampLength;
+
+ // Increments the reference count to the trace.
+ static void CreateTrace();
+ // Decrements the reference count to the trace.
+ static void ReturnTrace();
+ // Note: any instance that writes to the trace file should increment and
+ // decrement the reference count on construction and destruction,
+ // respectively.
+
+ // Specifies what type of messages should be written to the trace file. The
+ // filter parameter is a bitmask where each message type is enumerated by the
+ // TraceLevel enumerator. TODO(hellner): why is the TraceLevel enumerator not
+ // defined in this file?
+ static void set_level_filter(int filter);
+
+ // Returns what type of messages are written to the trace file.
+ static int level_filter();
+
+ // Sets the file name. If add_file_counter is false the same file will be
+ // reused when it fills up. If it's true a new file with incremented name
+ // will be used.
+ static int32_t SetTraceFile(const char* file_name,
+ const bool add_file_counter = false);
+
+ // Returns the name of the file that the trace is currently writing to.
+ static int32_t TraceFile(char file_name[1024]);
+
+ // Registers callback to receive trace messages.
+ // TODO(hellner): Why not use OutStream instead? Why is TraceCallback not
+ // defined in this file?
+ static int32_t SetTraceCallback(TraceCallback* callback);
+
+ // Adds a trace message for writing to file. The message is put in a queue
+ // for writing to file whenever possible for performance reasons. I.e. there
+ // is a crash it is possible that the last, vital logs are not logged yet.
+ // level is the type of message to log. If that type of messages is
+ // filtered it will not be written to file. module is an identifier for what
+ // part of the code the message is coming.
+ // id is an identifier that should be unique for that set of classes that
+ // are associated (e.g. all instances owned by an engine).
+ // msg and the ellipsis are the same as e.g. sprintf.
+ // TODO(hellner) Why is TraceModule not defined in this file?
+ static void Add(const TraceLevel level,
+ const TraceModule module,
+ const int32_t id,
+ const char* msg, ...);
+
+ private:
+ static volatile int level_filter_;
+};
+
+} // namespace webrtc
+
+#endif // WEBRTC_SYSTEM_WRAPPERS_INTERFACE_TRACE_H_