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 // 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