Java Code Examples for com.codahale.metrics.Slf4jReporter#LoggingLevel

The following examples show how to use com.codahale.metrics.Slf4jReporter#LoggingLevel . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LoggingMetricsService.java    From cerberus with Apache License 2.0 5 votes vote down vote up
public LoggingMetricsService(Slf4jReporter.LoggingLevel level, long period, TimeUnit timeUnit) {

    metricRegistry = new MetricRegistry();

    Slf4jReporter.forRegistry(metricRegistry)
        .outputTo(log)
        .withLoggingLevel(level)
        .scheduleOn(Executors.newSingleThreadScheduledExecutor())
        .build()
        .start(period, timeUnit);
  }
 
Example 2
Source File: LoggingLevelConverter.java    From graylog-plugin-metrics-reporter with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Slf4jReporter.LoggingLevel convertFrom(String value) {
    try {
        return Slf4jReporter.LoggingLevel.valueOf(Strings.nullToEmpty(value).toUpperCase(Locale.ENGLISH));
    } catch (IllegalArgumentException e) {
        throw new ParameterException("Couldn't convert value \"" + value + "\" to log level.", e);
    }
}
 
Example 3
Source File: LoggingLevelConverter.java    From graylog-plugin-metrics-reporter with GNU General Public License v3.0 5 votes vote down vote up
@Override
public String convertTo(Slf4jReporter.LoggingLevel value) {
    if (value == null) {
        throw new ParameterException("Couldn't convert \"null\" to string.");
    }
    return value.name();
}
 
Example 4
Source File: Slf4jSink.java    From eagle with Apache License 2.0 5 votes vote down vote up
private static Slf4jReporter.LoggingLevel getLoggingLevel(String level) {
    if (LEVEL_MAPPING.containsKey(level.toUpperCase())) {
        return LEVEL_MAPPING.get(level.toUpperCase());
    } else {
        throw new IllegalArgumentException("Illegal logging level: " + level);
    }
}
 
Example 5
Source File: CodahaleMetricsAssembler.java    From attic-polygene-java with Apache License 2.0 5 votes vote down vote up
public CodahaleMetricsAssembler withSlf4jReporter( Slf4jReporter.LoggingLevel level, long period, TimeUnit timeunit )
{
    declaration.reportersFactories.add( metricRegistry -> {
        Slf4jReporter reporter = Slf4jReporter.forRegistry( metricRegistry ).withLoggingLevel( level ).build();
        reporter.start( period, timeunit );
        return reporter;
    });
    return this;
}
 
Example 6
Source File: MetricsSlf4jReporterConfiguration.java    From graylog-plugin-metrics-reporter with GNU General Public License v3.0 4 votes vote down vote up
public Slf4jReporter.LoggingLevel getLevel() {
    return level;
}