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