2015-09-24 12:36:04 +02:00
|
|
|
/*
|
2019-01-10 15:13:51 -05:00
|
|
|
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
|
2015-09-24 12:36:04 +02:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
|
*
|
|
|
|
* This code is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License version 2 only, as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* version 2 for more details (a copy is included in the LICENSE file that
|
|
|
|
* accompanied this code).
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License version
|
|
|
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*
|
|
|
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
|
|
* or visit www.oracle.com if you need additional information or have any
|
|
|
|
* questions.
|
|
|
|
*
|
|
|
|
*/
|
2019-01-10 15:13:51 -05:00
|
|
|
#ifndef SHARE_LOGGING_LOGLEVEL_HPP
|
|
|
|
#define SHARE_LOGGING_LOGLEVEL_HPP
|
2015-09-24 12:36:04 +02:00
|
|
|
|
|
|
|
#include "memory/allocation.hpp"
|
|
|
|
#include "utilities/macros.hpp"
|
|
|
|
|
|
|
|
// The list of log levels:
|
|
|
|
//
|
2015-11-20 12:42:21 +01:00
|
|
|
// trace - Finest level of logging. Use for extensive/noisy
|
|
|
|
// logging that can give slow-down when enabled.
|
2015-09-24 12:36:04 +02:00
|
|
|
//
|
|
|
|
// debug - A finer level of logging. Use for semi-noisy
|
|
|
|
// logging that is does not fit the info level.
|
|
|
|
//
|
|
|
|
// info - General level of logging. Use for significant
|
|
|
|
// events and/or informative summaries.
|
|
|
|
//
|
|
|
|
// warning - Important messages that are not strictly errors.
|
|
|
|
//
|
|
|
|
// error - Critical messages caused by errors.
|
|
|
|
//
|
|
|
|
#define LOG_LEVEL_LIST \
|
|
|
|
LOG_LEVEL(Trace, trace) \
|
|
|
|
LOG_LEVEL(Debug, debug) \
|
|
|
|
LOG_LEVEL(Info, info) \
|
|
|
|
LOG_LEVEL(Warning, warning) \
|
|
|
|
LOG_LEVEL(Error, error)
|
|
|
|
|
|
|
|
class LogLevel : public AllStatic {
|
|
|
|
public:
|
|
|
|
enum type {
|
|
|
|
Off,
|
|
|
|
#define LOG_LEVEL(name, printname) name,
|
|
|
|
LOG_LEVEL_LIST
|
|
|
|
#undef LOG_LEVEL
|
|
|
|
Count,
|
|
|
|
Invalid,
|
2015-11-27 12:37:38 +01:00
|
|
|
NotMentioned,
|
2015-09-24 12:36:04 +02:00
|
|
|
First = Off + 1,
|
|
|
|
Last = Error,
|
|
|
|
Default = Warning,
|
|
|
|
Unspecified = Info
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char *name(LogLevel::type level) {
|
2015-11-27 12:37:38 +01:00
|
|
|
assert(level >= 0 && level < LogLevel::Count, "Invalid level (enum value %d).", level);
|
2015-09-24 12:36:04 +02:00
|
|
|
return _name[level];
|
|
|
|
}
|
|
|
|
|
|
|
|
static LogLevel::type from_string(const char* str);
|
2018-02-26 09:34:20 +01:00
|
|
|
static LogLevel::type fuzzy_match(const char *level);
|
2015-09-24 12:36:04 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
static const char* _name[];
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef LogLevel::type LogLevelType;
|
|
|
|
|
2019-01-10 15:13:51 -05:00
|
|
|
#endif // SHARE_LOGGING_LOGLEVEL_HPP
|