author | redestad |
Sun, 11 Dec 2016 12:20:45 +0100 | |
changeset 42469 | d1c0a9123f87 |
parent 34316 | 4d876653d940 |
permissions | -rw-r--r-- |
33097 | 1 |
/* |
2 |
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
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 |
// |
|
34252
59d76c40998a
8143229: Replace the develop level with develop macros in Unified Logging
mlarsson
parents:
33097
diff
changeset
|
32 |
// trace - Finest level of logging. Use for extensive/noisy |
59d76c40998a
8143229: Replace the develop level with develop macros in Unified Logging
mlarsson
parents:
33097
diff
changeset
|
33 |
// logging that can give slow-down when enabled. |
33097 | 34 |
// |
35 |
// debug - A finer level of logging. Use for semi-noisy |
|
36 |
// logging that is does not fit the info level. |
|
37 |
// |
|
38 |
// info - General level of logging. Use for significant |
|
39 |
// events and/or informative summaries. |
|
40 |
// |
|
41 |
// warning - Important messages that are not strictly errors. |
|
42 |
// |
|
43 |
// error - Critical messages caused by errors. |
|
44 |
// |
|
45 |
#define LOG_LEVEL_LIST \ |
|
46 |
LOG_LEVEL(Trace, trace) \ |
|
47 |
LOG_LEVEL(Debug, debug) \ |
|
48 |
LOG_LEVEL(Info, info) \ |
|
49 |
LOG_LEVEL(Warning, warning) \ |
|
50 |
LOG_LEVEL(Error, error) |
|
51 |
||
52 |
class LogLevel : public AllStatic { |
|
53 |
public: |
|
54 |
enum type { |
|
55 |
Off, |
|
56 |
#define LOG_LEVEL(name, printname) name, |
|
57 |
LOG_LEVEL_LIST |
|
58 |
#undef LOG_LEVEL |
|
59 |
Count, |
|
60 |
Invalid, |
|
34316
4d876653d940
8142952: Unified Logging framework does not allow multiple -Xlog: arguments.
mlarsson
parents:
34252
diff
changeset
|
61 |
NotMentioned, |
33097 | 62 |
First = Off + 1, |
63 |
Last = Error, |
|
64 |
Default = Warning, |
|
65 |
Unspecified = Info |
|
66 |
}; |
|
67 |
||
68 |
static const char *name(LogLevel::type level) { |
|
34316
4d876653d940
8142952: Unified Logging framework does not allow multiple -Xlog: arguments.
mlarsson
parents:
34252
diff
changeset
|
69 |
assert(level >= 0 && level < LogLevel::Count, "Invalid level (enum value %d).", level); |
33097 | 70 |
return _name[level]; |
71 |
} |
|
72 |
||
73 |
static LogLevel::type from_string(const char* str); |
|
74 |
||
75 |
private: |
|
76 |
static const char* _name[]; |
|
77 |
}; |
|
78 |
||
79 |
typedef LogLevel::type LogLevelType; |
|
80 |
||
81 |
#endif // SHARE_VM_LOGGING_LOGLEVEL_HPP |