Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8152635

Create a UL class to represent a Log + Level combination

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 9
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
      svc
    • Resolved In Build:
      b115

      Description

      I propose that we create a LogTarget class so that we can create a log object representing both a tag set and a tag level.

      With this class we write code as:
      LogTarget(Debug, gc, heap) log;
      if (log.is_enabled()) {
        log.print(...);
        log.print(...);
        ... = log.stream();
      }

      instead of the current model:
      Log(gc, heap) log;
      if (log.is_debug()) {
        log.debug(...)
        log.debug(...)
        ... = log.debug_stream():
      }

      The LogTarget class/macro ensures that we only mention the log level once, so that we don't accidentally log to the wrong level. The previous version forces the coder to repeat 'debug' four times.

        Attachments

          Activity

            People

            • Assignee:
              stefank Stefan Karlsson
              Reporter:
              stefank Stefan Karlsson
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: