1 /*
   2  * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.javafx.util;
  27 
  28 import sun.util.logging.PlatformLogger;
  29 
  30 /**
  31  * Holds PlatformLoggers to use for logging javafx-ui-common related things.
  32  */
  33 public class Logging {
  34     
  35     /**
  36      * A PlatformLogger to use for logging layout-related activities.  Created
  37      * lazily to delay calls to com.sun.javafx.tk.Toolkit.getToolkit() so that
  38      * it will not intefere with the build.
  39      */
  40     private static PlatformLogger layoutLogger = null;
  41     
  42     /**
  43      * Returns the PlatformLogger for logging layout-related activities.
  44      */
  45     public static final PlatformLogger getLayoutLogger() {
  46         if (layoutLogger == null) {
  47             layoutLogger = PlatformLogger.getLogger("javafx.scene.layout");
  48         }
  49         return layoutLogger;
  50     }
  51 
  52     /**
  53      * A PlatformLogger to use for logging focus-related activities.  Created
  54      * lazily to delay calls to com.sun.javafx.tk.Toolkit.getToolkit() so that
  55      * it will no intefere with the build.
  56      */
  57     private static PlatformLogger focusLogger = null;
  58 
  59     /**
  60      * Returns the PlatformLogger for logging focus-related activities.
  61      */
  62     public static final PlatformLogger getFocusLogger() {
  63         if (focusLogger == null) {
  64             focusLogger = PlatformLogger.getLogger("javafx.scene.focus");
  65         }
  66         return focusLogger;
  67     }
  68 
  69     /**
  70      * A PlatformLogger to use for logging input-related activities.  Created
  71      * lazily to delay calls to com.sun.javafx.tk.Toolkit.getToolkit() so that
  72      * it will no intefere with the build.
  73      */
  74     private static PlatformLogger inputLogger = null;
  75     
  76     /**
  77      * Returns the PlatformLogger for logging input-related activities.
  78      */
  79     public static final PlatformLogger getInputLogger() {
  80         if (inputLogger == null) {
  81             inputLogger = PlatformLogger.getLogger("javafx.scene.input");
  82         }
  83         return inputLogger;
  84     }
  85 
  86     /**
  87      * A PlatformLogger to use for logging CSS-related activities.  Created
  88      * lazily to delay calls to com.sun.javafx.tk.Toolkit.getToolkit() so that
  89      * it will no intefere with the build.
  90      */
  91     private static PlatformLogger cssLogger = null;
  92     
  93     /**
  94      * Returns the PlatformLogger for logging CSS-related activities.
  95      */
  96     public static final PlatformLogger getCSSLogger() {
  97         if (cssLogger == null) {
  98             cssLogger = PlatformLogger.getLogger("javafx.css");
  99         }
 100         return cssLogger;
 101     }
 102 
 103      /**
 104      * A PlatformLogger to use for logging general javafx related activities.
 105      * Created lazily to delay calls to com.sun.javafx.tk.Toolkit.getToolkit()
 106      * so that it will not interfere with the build.
 107      */
 108     private static PlatformLogger javafxLogger = null;
 109 
 110     /**
 111      * Returns the PlatformLogger for logging javafx general activities.
 112      */
 113     public static final PlatformLogger getJavaFXLogger() {
 114         if (javafxLogger == null) {
 115             javafxLogger = PlatformLogger.getLogger("javafx");
 116         }
 117         return javafxLogger;
 118     }
 119 
 120     /**
 121      * A PlatformLogger to use for logging layout-related activities.  Created
 122      * lazily to delay calls to com.sun.javafx.tk.Toolkit.getToolkit() so that
 123      * it will not intefere with the build.
 124      */
 125     private static PlatformLogger accessibilityLogger = null;
 126     
 127     /**
 128      * Returns the PlatformLogger for logging layout-related activities.
 129      */
 130     public static final PlatformLogger getAccessibilityLogger() {
 131         if (accessibilityLogger == null) {
 132             accessibilityLogger = PlatformLogger.getLogger("javafx.accessibility");
 133         }
 134         return accessibilityLogger;
 135     }
 136     
 137 }