Class CategoryLogger.ConditionalLogger

java.lang.Object
org.djutils.logger.CategoryLogger.ConditionalLogger
Enclosing class:
CategoryLogger

public static class CategoryLogger.ConditionalLogger
extends Object
ConditionalLogger class that takes care of filtering based on a condition.

Copyright (c) 2003-2019 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information www.simulation.tudelft.nl. The source code and binary code of this software is proprietary information of Delft University of Technology.
Author:
Alexander Verbraeck
  • Constructor Details

    • ConditionalLogger

      public ConditionalLogger​(boolean log)
      Parameters:
      log - boolean; indicate whether we should log or not.
  • Method Details

    • always

      The "pass" filter that will result in always trying to log.
      Returns:
      the logger that tries to execute logging (delegateLogger)
    • filter

      public CategoryLogger.DelegateLogger filter​(LogCategory logCategory)
      Check whether the provided category needs to be logged. Note that when LogCategory.ALL is contained in the categories, filter will return true.
      Parameters:
      logCategory - LogCategory; the category to check for.
      Returns:
      the logger that either tries to log (delegateLogger), or returns without logging (noLogger)
    • filter

      public CategoryLogger.DelegateLogger filter​(LogCategory... logCategories)
      Check whether the provided categories contain one or more categories that need to be logged. Note that when LogCategory.ALL is contained in the categories, filter will return true.
      Parameters:
      logCategories - LogCategory...; elements or array with the categories to check for
      Returns:
      the logger that either tries to log (delegateLogger), or returns without logging (noLogger)