OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 * | 9 * |
10 * System independent wrapper for logging runtime information to file. | 10 * System independent wrapper for logging runtime information to file. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 // Returns what type of messages are written to the trace file. | 54 // Returns what type of messages are written to the trace file. |
55 static int level_filter(); | 55 static int level_filter(); |
56 | 56 |
57 // Sets the file name. If add_file_counter is false the same file will be | 57 // Sets the file name. If add_file_counter is false the same file will be |
58 // reused when it fills up. If it's true a new file with incremented name | 58 // reused when it fills up. If it's true a new file with incremented name |
59 // will be used. | 59 // will be used. |
60 static int32_t SetTraceFile(const char* file_name, | 60 static int32_t SetTraceFile(const char* file_name, |
61 const bool add_file_counter = false); | 61 const bool add_file_counter = false); |
62 | 62 |
63 // Returns the name of the file that the trace is currently writing to. | |
64 static int32_t TraceFile(char file_name[1024]); | |
65 | |
66 // Registers callback to receive trace messages. | 63 // Registers callback to receive trace messages. |
67 // TODO(hellner): Why not use OutStream instead? Why is TraceCallback not | 64 // TODO(hellner): Why not use OutStream instead? Why is TraceCallback not |
68 // defined in this file? | 65 // defined in this file? |
69 static int32_t SetTraceCallback(TraceCallback* callback); | 66 static int32_t SetTraceCallback(TraceCallback* callback); |
70 | 67 |
71 // Adds a trace message for writing to file. The message is put in a queue | 68 // Adds a trace message for writing to file. The message is put in a queue |
72 // for writing to file whenever possible for performance reasons. I.e. there | 69 // for writing to file whenever possible for performance reasons. I.e. there |
73 // is a crash it is possible that the last, vital logs are not logged yet. | 70 // is a crash it is possible that the last, vital logs are not logged yet. |
74 // level is the type of message to log. If that type of messages is | 71 // level is the type of message to log. If that type of messages is |
75 // filtered it will not be written to file. module is an identifier for what | 72 // filtered it will not be written to file. module is an identifier for what |
76 // part of the code the message is coming. | 73 // part of the code the message is coming. |
77 // id is an identifier that should be unique for that set of classes that | 74 // id is an identifier that should be unique for that set of classes that |
78 // are associated (e.g. all instances owned by an engine). | 75 // are associated (e.g. all instances owned by an engine). |
79 // msg and the ellipsis are the same as e.g. sprintf. | 76 // msg and the ellipsis are the same as e.g. sprintf. |
80 // TODO(hellner) Why is TraceModule not defined in this file? | 77 // TODO(hellner) Why is TraceModule not defined in this file? |
81 static void Add(const TraceLevel level, | 78 static void Add(const TraceLevel level, |
82 const TraceModule module, | 79 const TraceModule module, |
83 const int32_t id, | 80 const int32_t id, |
84 const char* msg, ...); | 81 const char* msg, ...); |
85 | 82 |
86 private: | 83 private: |
87 static volatile int level_filter_; | 84 static volatile int level_filter_; |
88 }; | 85 }; |
89 | 86 |
90 } // namespace webrtc | 87 } // namespace webrtc |
91 | 88 |
92 #endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_TRACE_H_ | 89 #endif // WEBRTC_SYSTEM_WRAPPERS_INCLUDE_TRACE_H_ |
OLD | NEW |