@Override
  public boolean enable() {
    try {
      PrintStream stream = createPrintStream();

      // static enable() methods omit the option of specifying a
      // predicate.  Calling constructor and starting manually
      // instead
      final ConsoleReporter reporter =
          new ConsoleReporter(
              Metrics.defaultRegistry(),
              stream,
              MetricPredicateTransformer.generatePredicate(getPredicate()));

      reporter.start(getPeriod(), getRealTimeunit());
    } catch (Exception e) {
      log.error("Failure while enabling console reporter", e);
      return false;
    }
    return true;
  }
 /**
  * Enables the console reporter for the given metrics registry, and causes it to print to STDOUT
  * with the specified period and unrestricted output.
  *
  * @param metricsRegistry the metrics registry
  * @param period the period between successive outputs
  * @param unit the time unit of {@code period}
  */
 public static void enable(MetricsRegistry metricsRegistry, long period, TimeUnit unit) {
   final ConsoleReporter reporter =
       new ConsoleReporter(metricsRegistry, System.out, MetricPredicate.ALL);
   reporter.start(period, unit);
 }