6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24 #ifndef SHARE_VM_LOGGING_LOGLEVEL_HPP
25 #define SHARE_VM_LOGGING_LOGLEVEL_HPP
26 #include "utilities/macros.hpp"
27
28 // The list of log levels:
29 //
30 // develop - A non-product level that is finer than trace.
31 // Should be used for really expensive and/or
32 // extensive logging, or logging that shouldn't
33 // or can't be included in a product build.
34 //
35 // trace - Finest level of logging in product builds.
36 // Use for extensive/noisy logging that can
37 // give slow-down when enabled.
38 //
39 // debug - A finer level of logging. Use for semi-noisy
40 // logging that is does not fit the info level.
41 //
42 // info - General level of logging. Use for significant
43 // events and/or informative summaries.
44 //
45 // warning - Important messages that are not strictly errors.
46 //
47 // error - Critical messages caused by errors.
48 //
49 #define LOG_LEVEL_LIST \
50 NOT_PRODUCT(LOG_LEVEL(Develop, develop)) \
51 LOG_LEVEL(Trace, trace) \
52 LOG_LEVEL(Debug, debug) \
53 LOG_LEVEL(Info, info) \
54 LOG_LEVEL(Warning, warning) \
55 LOG_LEVEL(Error, error)
56
57 class LogLevel {
58 public:
59 enum type {
60 Off,
61 #define LOG_LEVEL(name, printname) name,
62 LOG_LEVEL_LIST
63 #undef LOG_LEVEL
64 Count,
65 Invalid,
66 First = Off + 1,
67 Last = Error,
68 Default = Warning,
69 Unspecified = Info
70 };
71
72 static const char *name(LogLevel::type level) {
73 return _name[level];
74 }
75
76 static LogLevel::type from_string(const char* str);
77
78 private:
79 static const char* _name[];
80 };
81
82 typedef LogLevel::type LogLevelType;
83
84 #endif
|
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24 #ifndef SHARE_VM_LOGGING_LOGLEVEL_HPP
25 #define SHARE_VM_LOGGING_LOGLEVEL_HPP
26
27 #include "memory/allocation.hpp"
28 #include "utilities/macros.hpp"
29
30 // The list of log levels:
31 //
32 // develop - A non-product level that is finer than trace.
33 // Should be used for really expensive and/or
34 // extensive logging, or logging that shouldn't
35 // or can't be included in a product build.
36 //
37 // trace - Finest level of logging in product builds.
38 // Use for extensive/noisy logging that can
39 // give slow-down when enabled.
40 //
41 // debug - A finer level of logging. Use for semi-noisy
42 // logging that is does not fit the info level.
43 //
44 // info - General level of logging. Use for significant
45 // events and/or informative summaries.
46 //
47 // warning - Important messages that are not strictly errors.
48 //
49 // error - Critical messages caused by errors.
50 //
51 #define LOG_LEVEL_LIST \
52 NOT_PRODUCT(LOG_LEVEL(Develop, develop)) \
53 LOG_LEVEL(Trace, trace) \
54 LOG_LEVEL(Debug, debug) \
55 LOG_LEVEL(Info, info) \
56 LOG_LEVEL(Warning, warning) \
57 LOG_LEVEL(Error, error)
58
59 class LogLevel : public AllStatic {
60 public:
61 enum type {
62 Off,
63 #define LOG_LEVEL(name, printname) name,
64 LOG_LEVEL_LIST
65 #undef LOG_LEVEL
66 Count,
67 Invalid,
68 First = Off + 1,
69 Last = Error,
70 Default = Warning,
71 Unspecified = Info
72 };
73
74 static const char *name(LogLevel::type level) {
75 return _name[level];
76 }
77
78 static LogLevel::type from_string(const char* str);
79
80 private:
81 static const char* _name[];
82 };
83
84 typedef LogLevel::type LogLevelType;
85
86 #endif // SHARE_VM_LOGGING_LOGLEVEL_HPP
|