NoSpamLogger (apache-cassandra API)
Date: 2018-02-12

org.apache.cassandra.utils

## Class NoSpamLogger

- java.lang.Object
- - org.apache.cassandra.utils.NoSpamLogger

-     public class NoSpamLogger
      extends java.lang.Object

  Logging that limits each log statement to firing based on time since the statement last fired. Every logger has a unique timer per statement. Minimum time between logging is set for each statement the first time it is used and a subsequent attempt to request that statement with a different minimum time will result in the original time being used. No warning is provided if there is a mismatch. If the statement is cached and used to log directly then only a volatile read will be required in the common case. If the Logger is cached then there is a single concurrent hash map lookup + the volatile read. If neither the logger nor the statement is cached then it is two concurrent hash map lookups + the volatile read.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `NoSpamLogger.Level` Levels for programmatically specifying the severity of a log statement
    `class` | `NoSpamLogger.NoSpamLogStatement`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `error(long nowNanos, java.lang.String s, java.lang.Object... objects)`
    `void` | `error(java.lang.String s, java.lang.Object... objects)`
    `static NoSpamLogger` | `getLogger(org.slf4j.Logger logger, long minInterval, java.util.concurrent.TimeUnit unit)`
    `static NoSpamLogger.NoSpamLogStatement` | `getStatement(org.slf4j.Logger logger, java.lang.String message, long minInterval, java.util.concurrent.TimeUnit unit)`
    `NoSpamLogger.NoSpamLogStatement` | `getStatement(java.lang.String s)`
    `NoSpamLogger.NoSpamLogStatement` | `getStatement(java.lang.String s, long minIntervalNanos)`
    `NoSpamLogger.NoSpamLogStatement` | `getStatement(java.lang.String s, long minInterval, java.util.concurrent.TimeUnit unit)`
    `void` | `info(long nowNanos, java.lang.String s, java.lang.Object... objects)`
    `void` | `info(java.lang.String s, java.lang.Object... objects)`
    `static void` | `log(org.slf4j.Logger logger, NoSpamLogger.Level level, long minInterval, java.util.concurrent.TimeUnit unit, long nowNanos, java.lang.String message, java.lang.Object... objects)`
    `static void` | `log(org.slf4j.Logger logger, NoSpamLogger.Level level, long minInterval, java.util.concurrent.TimeUnit unit, java.lang.String message, java.lang.Object... objects)`
    `void` | `log(NoSpamLogger.Level l, java.lang.String s, long nowNanos, java.lang.Object... objects)`
    `void` | `warn(long nowNanos, java.lang.String s, java.lang.Object... objects)`
    `void` | `warn(java.lang.String s, java.lang.Object... objects)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### getLogger

          public static NoSpamLogger getLogger(org.slf4j.Logger logger,
                                               long minInterval,
                                               java.util.concurrent.TimeUnit unit)

    - #### log

          public static void log(org.slf4j.Logger logger,
                                 NoSpamLogger.Level level,
                                 long minInterval,
                                 java.util.concurrent.TimeUnit unit,
                                 java.lang.String message,
                                 java.lang.Object... objects)

    - #### log

          public static void log(org.slf4j.Logger logger,
                                 NoSpamLogger.Level level,
                                 long minInterval,
                                 java.util.concurrent.TimeUnit unit,
                                 long nowNanos,
                                 java.lang.String message,
                                 java.lang.Object... objects)

    - #### getStatement

          public static NoSpamLogger.NoSpamLogStatement getStatement(org.slf4j.Logger logger,
                                                                     java.lang.String message,
                                                                     long minInterval,
                                                                     java.util.concurrent.TimeUnit unit)

    - #### info

          public void info(long nowNanos,
                           java.lang.String s,
                           java.lang.Object... objects)

    - #### info

          public void info(java.lang.String s,
                           java.lang.Object... objects)

    - #### warn

          public void warn(long nowNanos,
                           java.lang.String s,
                           java.lang.Object... objects)

    - #### warn

          public void warn(java.lang.String s,
                           java.lang.Object... objects)

    - #### error

          public void error(long nowNanos,
                            java.lang.String s,
                            java.lang.Object... objects)

    - #### error

          public void error(java.lang.String s,
                            java.lang.Object... objects)

    - #### log

          public void log(NoSpamLogger.Level l,
                          java.lang.String s,
                          long nowNanos,
                          java.lang.Object... objects)

    - #### getStatement

          public NoSpamLogger.NoSpamLogStatement getStatement(java.lang.String s)

    - #### getStatement

          public NoSpamLogger.NoSpamLogStatement getStatement(java.lang.String s,
                                                              long minInterval,
                                                              java.util.concurrent.TimeUnit unit)

    - #### getStatement

          public NoSpamLogger.NoSpamLogStatement getStatement(java.lang.String s,
                                                              long minIntervalNanos)

Copyright © 2018 The Apache Software Foundation