1 /* |
1 /* |
2 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
26 package sun.java2d.marlin; |
26 package sun.java2d.marlin; |
27 |
27 |
28 |
28 |
29 public final class MarlinUtils { |
29 public final class MarlinUtils { |
30 // Marlin logger |
30 // Marlin logger |
31 private static final sun.util.logging.PlatformLogger log; |
31 private static final sun.util.logging.PlatformLogger LOG; |
32 |
32 |
33 static { |
33 static { |
34 if (MarlinConst.useLogger) { |
34 if (MarlinConst.USE_LOGGER) { |
35 log = sun.util.logging.PlatformLogger.getLogger("sun.java2d.marlin"); |
35 LOG = sun.util.logging.PlatformLogger.getLogger("sun.java2d.marlin"); |
36 } else { |
36 } else { |
37 log = null; |
37 LOG = null; |
38 } |
38 } |
39 } |
39 } |
40 |
40 |
41 private MarlinUtils() { |
41 private MarlinUtils() { |
42 // no-op |
42 // no-op |
43 } |
43 } |
44 |
44 |
45 public static void logInfo(final String msg) { |
45 public static void logInfo(final String msg) { |
46 if (MarlinConst.useLogger) { |
46 if (MarlinConst.USE_LOGGER) { |
47 log.info(msg); |
47 LOG.info(msg); |
48 } else if (MarlinConst.enableLogs) { |
48 } else if (MarlinConst.ENABLE_LOGS) { |
49 System.out.print("INFO: "); |
49 System.out.print("INFO: "); |
50 System.out.println(msg); |
50 System.out.println(msg); |
51 } |
51 } |
52 } |
52 } |
53 |
53 |
54 public static void logException(final String msg, final Throwable th) { |
54 public static void logException(final String msg, final Throwable th) { |
55 if (MarlinConst.useLogger) { |
55 if (MarlinConst.USE_LOGGER) { |
56 log.warning(msg, th); |
56 LOG.warning(msg, th); |
57 } else if (MarlinConst.enableLogs) { |
57 } else if (MarlinConst.ENABLE_LOGS) { |
58 System.out.print("WARNING: "); |
58 System.out.print("WARNING: "); |
59 System.out.println(msg); |
59 System.out.println(msg); |
60 th.printStackTrace(System.err); |
60 th.printStackTrace(System.err); |
61 } |
61 } |
62 } |
62 } |