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

Side by Side Diff: mojo/public/c/environment/logger.h

Issue 339923003: Mojo: Add a C definition for MOJO_LOG_LEVEL_VERBOSE. (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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 MOJO_PUBLIC_C_ENVIRONMENT_LOGGER_H_ 5 #ifndef MOJO_PUBLIC_C_ENVIRONMENT_LOGGER_H_
6 #define MOJO_PUBLIC_C_ENVIRONMENT_LOGGER_H_ 6 #define MOJO_PUBLIC_C_ENVIRONMENT_LOGGER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 // |MojoLogLevel|: Used to specify the type of log message. Values are ordered 10 // |MojoLogLevel|: Used to specify the type of log message. Values are ordered
11 // by severity (i.e., higher numerical values are more severe). 11 // by severity (i.e., higher numerical values are more severe).
12 12
13 typedef int32_t MojoLogLevel; 13 typedef int32_t MojoLogLevel;
14 14
15 #ifdef __cplusplus 15 #ifdef __cplusplus
16 const MojoLogLevel MOJO_LOG_LEVEL_VERBOSE = -1; 16 const MojoLogLevel MOJO_LOG_LEVEL_VERBOSE = -1;
17 const MojoLogLevel MOJO_LOG_LEVEL_INFO = 0; 17 const MojoLogLevel MOJO_LOG_LEVEL_INFO = 0;
18 const MojoLogLevel MOJO_LOG_LEVEL_WARNING = 1; 18 const MojoLogLevel MOJO_LOG_LEVEL_WARNING = 1;
19 const MojoLogLevel MOJO_LOG_LEVEL_ERROR = 2; 19 const MojoLogLevel MOJO_LOG_LEVEL_ERROR = 2;
20 const MojoLogLevel MOJO_LOG_LEVEL_FATAL = 3; 20 const MojoLogLevel MOJO_LOG_LEVEL_FATAL = 3;
21 #else 21 #else
22 #define MOJO_LOG_LEVEL_VERBOSE ((MojoLogLevel) -1)
22 #define MOJO_LOG_LEVEL_INFO ((MojoLogLevel) 0) 23 #define MOJO_LOG_LEVEL_INFO ((MojoLogLevel) 0)
23 #define MOJO_LOG_LEVEL_WARNING ((MojoLogLevel) 1) 24 #define MOJO_LOG_LEVEL_WARNING ((MojoLogLevel) 1)
24 #define MOJO_LOG_LEVEL_ERROR ((MojoLogLevel) 2) 25 #define MOJO_LOG_LEVEL_ERROR ((MojoLogLevel) 2)
25 #define MOJO_LOG_LEVEL_FATAL ((MojoLogLevel) 3) 26 #define MOJO_LOG_LEVEL_FATAL ((MojoLogLevel) 3)
26 #endif 27 #endif
27 28
28 // Structure with basic logging functions (on top of which more friendly logging 29 // Structure with basic logging functions (on top of which more friendly logging
29 // macros may be built). The functions are thread-safe. 30 // macros may be built). The functions are thread-safe.
30 struct MojoLogger { 31 struct MojoLogger {
31 // Logs |message| at level |log_level| if |log_level| is at least the current 32 // Logs |message| at level |log_level| if |log_level| is at least the current
32 // minimum log level. If |log_level| is |MOJO_LOG_LEVEL_FATAL| (or greater), 33 // minimum log level. If |log_level| is |MOJO_LOG_LEVEL_FATAL| (or greater),
33 // aborts the application/process. 34 // aborts the application/process.
34 void (*LogMessage)(MojoLogLevel log_level, const char* message); 35 void (*LogMessage)(MojoLogLevel log_level, const char* message);
35 36
36 // Gets the minimum log level (see above), which will always be at most 37 // Gets the minimum log level (see above), which will always be at most
37 // |MOJO_LOG_LEVEL_FATAL|. (Though |LogMessage()| will automatically avoid 38 // |MOJO_LOG_LEVEL_FATAL|. (Though |LogMessage()| will automatically avoid
38 // logging messages below the minimum log level, this may be used to avoid 39 // logging messages below the minimum log level, this may be used to avoid
39 // extra work.) 40 // extra work.)
40 MojoLogLevel (*GetMinimumLogLevel)(void); 41 MojoLogLevel (*GetMinimumLogLevel)(void);
41 }; 42 };
42 43
43 #endif // MOJO_PUBLIC_C_ENVIRONMENT_LOGGER_H_ 44 #endif // MOJO_PUBLIC_C_ENVIRONMENT_LOGGER_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698