All Downloads are FREE. Search and download functionalities are using the official Maven repository.

br.com.objectos.logging.Logger Maven / Gradle / Ivy

Go to download

The Objectos Logging API. This is the API only, an implementation is needed during runtime.

There is a newer version: 3.1.0
Show newest version
/*
 * Copyright (C) 2021-2022 Objectos Software LTDA.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package br.com.objectos.logging;

/**
 * An object responsible for logging the events of a program.
 *
 * @since 2
 *
 * @see Event
 */
public interface Logger {

  /**
   * Returns {@code true} if the given {@code event} would be logged by this
   * {@code Logger} instance.
   *
   * @param event
   *        the event to test
   *
   * @return {@code true} if the given {@code event} would be logged
   */
  boolean isEnabled(Event event);

  /**
   * Logs the given event that takes no argument.
   *
   * @param event
   *        an event instance
   */
  void log(Event0 event);

  /**
   * Logs the given event that takes one argument.
   *
   * @param  type of the log argument
   * @param event
   *        an event instance
   * @param v1
   *        argument of the logged event
   */
   void log(Event1 event, T1 v1);

  /**
   * Logs the given event that takes two arguments.
   *
   * @param  type of the first log argument
   * @param  type of the second log argument
   * @param event
   *        an event instance
   * @param v1
   *        first argument of the logged event
   * @param v2
   *        second argument of the logged event
   */
   void log(Event2 event, T1 v1, T2 v2);

  /**
   * Logs the given event that takes three arguments.
   *
   * @param  type of the first log argument
   * @param  type of the second log argument
   * @param  type of the third log argument
   * @param event
   *        an event instance
   * @param v1
   *        first argument of the logged event
   * @param v2
   *        second argument of the logged event
   * @param v3
   *        third argument of the logged event
   */
   void log(Event3 event, T1 v1, T2 v2, T3 v3);

  /**
   * Replaces this instance with the given {@code logger} instance if it is
   * possible to do so.
   *
   * @param logger
   *        a {@code Logger} instance that may replace this instance
   *
   * @return the given {@code logger} instance or this instance
   */
  Logger replace(Logger logger);

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy