src/hotspot/share/logging/logLevel.hpp
author coleenp
Thu, 10 Jan 2019 15:13:51 -0500
changeset 53244 9807daeb47c4
parent 49163 580bb0b85f63
permissions -rw-r--r--
8216167: Update include guards to reflect correct directories Summary: Use script and some manual fixup to fix directores names in include guards. Reviewed-by: lfoltan, eosterlund, kbarrett
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
33097
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49163
diff changeset
     2
 * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
33097
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
     4
 *
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
     7
 * published by the Free Software Foundation.
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
     8
 *
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    13
 * accompanied this code).
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    14
 *
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    18
 *
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    21
 * questions.
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    22
 *
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    23
 */
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49163
diff changeset
    24
#ifndef SHARE_LOGGING_LOGLEVEL_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49163
diff changeset
    25
#define SHARE_LOGGING_LOGLEVEL_HPP
33097
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    26
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    27
#include "memory/allocation.hpp"
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    28
#include "utilities/macros.hpp"
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    29
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    30
// The list of log levels:
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    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
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    34
//
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    35
//  debug   - A finer level of logging. Use for semi-noisy
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    36
//            logging that is does not fit the info level.
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    37
//
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    38
//  info    - General level of logging. Use for significant
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    39
//            events and/or informative summaries.
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    40
//
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    41
//  warning - Important messages that are not strictly errors.
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    42
//
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    43
//  error   - Critical messages caused by errors.
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    44
//
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    45
#define LOG_LEVEL_LIST \
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    46
  LOG_LEVEL(Trace, trace) \
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    47
  LOG_LEVEL(Debug, debug) \
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    48
  LOG_LEVEL(Info, info) \
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    49
  LOG_LEVEL(Warning, warning) \
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    50
  LOG_LEVEL(Error, error)
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    51
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    52
class LogLevel : public AllStatic {
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    53
 public:
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    54
  enum type {
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    55
    Off,
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    56
#define LOG_LEVEL(name, printname) name,
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    57
    LOG_LEVEL_LIST
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    58
#undef LOG_LEVEL
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    59
    Count,
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    60
    Invalid,
34316
4d876653d940 8142952: Unified Logging framework does not allow multiple -Xlog: arguments.
mlarsson
parents: 34252
diff changeset
    61
    NotMentioned,
33097
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    62
    First = Off + 1,
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    63
    Last = Error,
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    64
    Default = Warning,
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    65
    Unspecified = Info
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    66
  };
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    67
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    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
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    70
    return _name[level];
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    71
  }
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    72
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    73
  static LogLevel::type from_string(const char* str);
49163
580bb0b85f63 8198554: Add fuzzy matching for log levels and tags when parsing -Xlog
mlarsson
parents: 47216
diff changeset
    74
  static LogLevel::type fuzzy_match(const char *level);
33097
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    75
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    76
 private:
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    77
  static const char* _name[];
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    78
};
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    79
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    80
typedef LogLevel::type LogLevelType;
96e348cb0442 8046148: JEP 158: Unified JVM Logging
mlarsson
parents:
diff changeset
    81
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49163
diff changeset
    82
#endif // SHARE_LOGGING_LOGLEVEL_HPP