Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(785)

Side by Side Diff: native_client_sdk/src/libraries/nacl_io/log.h

Issue 349703003: [NaCl SDK] Add some more logging to nacl_io. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 /* Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be 2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file. */ 3 * found in the LICENSE file. */
4 4
5 #ifndef LIBRARIES_NACL_IO_LOG_H_ 5 #ifndef LIBRARIES_NACL_IO_LOG_H_
6 #define LIBRARIES_NACL_IO_LOG_H_ 6 #define LIBRARIES_NACL_IO_LOG_H_
7 7
8 #include "sdk_util/macros.h" 8 #include "sdk_util/macros.h"
9 9
10 #define LOG_PREFIX "nacl_io: " 10 #define LOG_PREFIX "nacl_io: "
11 11
12 #if NACL_IO_LOGGING 12 #if NACL_IO_LOGGING
13 #define LOG_TRACE(format, ...) \ 13 #define LOG_TRACE(format, ...) \
14 nacl_io_log(LOG_PREFIX format "\n", ##__VA_ARGS__) 14 nacl_io_log(LOG_PREFIX format "\n", ##__VA_ARGS__)
15 #else 15 #else
16 #define LOG_TRACE(format, ...) 16 #define LOG_TRACE(format, ...)
17 #endif 17 #endif
18 18
19 #define LOG_ERROR(format, ...) \ 19 #define LOG_ERROR(format, ...) \
20 nacl_io_log(LOG_PREFIX "error: " format "\n", ##__VA_ARGS__) 20 nacl_io_log(LOG_PREFIX "%s:%d: error: " format "\n", \
21 __FILE__, \
22 __LINE__, \
23 ##__VA_ARGS__)
21 24
22 #define LOG_WARN(format, ...) \ 25 #define LOG_WARN(format, ...) \
23 nacl_io_log(LOG_PREFIX "warning: " format "\n", ##__VA_ARGS__) 26 nacl_io_log(LOG_PREFIX "%s:%d: warning: " format "\n", \
27 __FILE__, \
28 __LINE__, \
29 ##__VA_ARGS__)
24 30
25 EXTERN_C_BEGIN 31 EXTERN_C_BEGIN
26 32
27 /* 33 /*
28 * Low level logging function for nacl_io log messages. 34 * Low level logging function for nacl_io log messages.
29 * 35 *
30 * This function sends its output directly to the IRT standard out 36 * This function sends its output directly to the IRT standard out
31 * file descriptor, which by default will apear on the standard out 37 * file descriptor, which by default will apear on the standard out
32 * or chrome or sel_ldr. 38 * or chrome or sel_ldr.
33 */ 39 */
34 void nacl_io_log(const char* format, ...) PRINTF_LIKE(1, 2); 40 void nacl_io_log(const char* format, ...) PRINTF_LIKE(1, 2);
35 41
36 EXTERN_C_END 42 EXTERN_C_END
37 43
38 #endif /* LIBRARIES_NACL_IO_LOG_H_ */ 44 #endif /* LIBRARIES_NACL_IO_LOG_H_ */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698