Path: blob/master/src/hotspot/share/logging/logLevel.hpp
40930 views
/*1* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/23#ifndef SHARE_LOGGING_LOGLEVEL_HPP24#define SHARE_LOGGING_LOGLEVEL_HPP2526#include "memory/allocation.hpp"27#include "utilities/macros.hpp"2829// The list of log levels:30//31// trace - Finest level of logging. Use for extensive/noisy32// logging that can give slow-down when enabled.33//34// debug - A finer level of logging. Use for semi-noisy35// logging that is does not fit the info level.36//37// info - General level of logging. Use for significant38// events and/or informative summaries.39//40// warning - Important messages that are not strictly errors.41//42// error - Critical messages caused by errors.43//44#define LOG_LEVEL_LIST \45LOG_LEVEL(Trace, trace) \46LOG_LEVEL(Debug, debug) \47LOG_LEVEL(Info, info) \48LOG_LEVEL(Warning, warning) \49LOG_LEVEL(Error, error)5051class LogLevel : public AllStatic {52public:53enum type {54Off,55#define LOG_LEVEL(name, printname) name,56LOG_LEVEL_LIST57#undef LOG_LEVEL58Count,59Invalid,60NotMentioned,61First = Off + 1,62Last = Error,63Default = Warning,64Unspecified = Info65};6667static const char *name(LogLevel::type level) {68assert(level >= 0 && level < LogLevel::Count, "Invalid level (enum value %d).", level);69return _name[level];70}7172static LogLevel::type from_string(const char* str);73static LogLevel::type fuzzy_match(const char *level);7475private:76static const char* _name[];77};7879typedef LogLevel::type LogLevelType;8081#endif // SHARE_LOGGING_LOGLEVEL_HPP828384