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

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

Issue 814543006: Move //mojo/{public, edk} underneath //third_party (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 11 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
« no previous file with comments | « mojo/public/c/environment/async_waiter.h ('k') | mojo/public/c/gles2/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MOJO_PUBLIC_C_ENVIRONMENT_LOGGER_H_
6 #define MOJO_PUBLIC_C_ENVIRONMENT_LOGGER_H_
7
8 #include <stdint.h>
9
10 // |MojoLogLevel|: Used to specify the type of log message. Values are ordered
11 // by severity (i.e., higher numerical values are more severe).
12
13 typedef int32_t MojoLogLevel;
14
15 #ifdef __cplusplus
16 const MojoLogLevel MOJO_LOG_LEVEL_VERBOSE = -1;
17 const MojoLogLevel MOJO_LOG_LEVEL_INFO = 0;
18 const MojoLogLevel MOJO_LOG_LEVEL_WARNING = 1;
19 const MojoLogLevel MOJO_LOG_LEVEL_ERROR = 2;
20 const MojoLogLevel MOJO_LOG_LEVEL_FATAL = 3;
21 #else
22 #define MOJO_LOG_LEVEL_VERBOSE ((MojoLogLevel) - 1)
23 #define MOJO_LOG_LEVEL_INFO ((MojoLogLevel)0)
24 #define MOJO_LOG_LEVEL_WARNING ((MojoLogLevel)1)
25 #define MOJO_LOG_LEVEL_ERROR ((MojoLogLevel)2)
26 #define MOJO_LOG_LEVEL_FATAL ((MojoLogLevel)3)
27 #endif
28
29 // Structure with basic logging functions (on top of which more friendly logging
30 // macros may be built). The functions are thread-safe, except for
31 // |SetMinimumLogLevel()| (see below).
32 struct MojoLogger {
33 // Logs |message| at level |log_level| if |log_level| is at least the current
34 // minimum log level. If |log_level| is |MOJO_LOG_LEVEL_FATAL| (or greater),
35 // aborts the application/process.
36 void (*LogMessage)(MojoLogLevel log_level, const char* message);
37
38 // Gets the minimum log level (see above), which will always be at most
39 // |MOJO_LOG_LEVEL_FATAL|. (Though |LogMessage()| will automatically avoid
40 // logging messages below the minimum log level, this may be used to avoid
41 // extra work.)
42 MojoLogLevel (*GetMinimumLogLevel)(void);
43
44 // Sets the minimum log level (see above) to the lesser of |minimum_log_level|
45 // and |MOJO_LOG_LEVEL_FATAL|.
46 //
47 // Warning: This function may not be thread-safe, and should not be called
48 // concurrently with other |MojoLogger| functions. (In some environments --
49 // such as Chromium -- that share a logger across applications, this may mean
50 // that it is almost never safe to call this.)
51 void (*SetMinimumLogLevel)(MojoLogLevel minimum_log_level);
52 };
53
54 #endif // MOJO_PUBLIC_C_ENVIRONMENT_LOGGER_H_
OLDNEW
« no previous file with comments | « mojo/public/c/environment/async_waiter.h ('k') | mojo/public/c/gles2/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698