src/main/kotlin/de/uapcore/lightpit/MyLogger.kt

Wed, 15 Dec 2021 19:56:05 +0100

author
Mike Becker <universe@uap-core.de>
date
Wed, 15 Dec 2021 19:56:05 +0100
changeset 247
e71ae69c68c0
permissions
-rw-r--r--

remove log4j entirely

universe@247 1 /*
universe@247 2 * Copyright 2021 Mike Becker. All rights reserved.
universe@247 3 *
universe@247 4 * Redistribution and use in source and binary forms, with or without
universe@247 5 * modification, are permitted provided that the following conditions are met:
universe@247 6 *
universe@247 7 * 1. Redistributions of source code must retain the above copyright
universe@247 8 * notice, this list of conditions and the following disclaimer.
universe@247 9 *
universe@247 10 * 2. Redistributions in binary form must reproduce the above copyright
universe@247 11 * notice, this list of conditions and the following disclaimer in the
universe@247 12 * documentation and/or other materials provided with the distribution.
universe@247 13 *
universe@247 14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
universe@247 15 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
universe@247 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
universe@247 17 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
universe@247 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
universe@247 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
universe@247 20 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
universe@247 21 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
universe@247 22 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
universe@247 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
universe@247 24 */
universe@247 25
universe@247 26 package de.uapcore.lightpit
universe@247 27
universe@247 28 import java.util.logging.Level
universe@247 29 import java.util.logging.Logger
universe@247 30
universe@247 31 class MyLogger {
universe@247 32 private val logger: Logger = Logger.getLogger("de.uapcore.lightpit.Logger")
universe@247 33
universe@247 34 fun info(fmt: String, vararg args: Any?) {
universe@247 35 logger.log(Level.INFO, fmt, args)
universe@247 36 }
universe@247 37 fun debug(fmt: String, vararg args: Any?) {
universe@247 38 logger.log(Level.FINE, fmt, args)
universe@247 39 }
universe@247 40 fun warn(fmt: String, vararg args: Any?) {
universe@247 41 logger.log(Level.WARNING, fmt, args)
universe@247 42 }
universe@247 43 fun error(fmt: String, vararg args: Any?) {
universe@247 44 logger.log(Level.SEVERE, fmt, args)
universe@247 45 }
universe@247 46 fun trace(fmt: String, vararg args: Any?) {
universe@247 47 logger.log(Level.FINEST, fmt, args)
universe@247 48 }
universe@247 49
universe@247 50 fun info(msg: String, ex: Throwable) {
universe@247 51 logger.log(Level.INFO, msg, ex)
universe@247 52 }
universe@247 53 fun debug(msg: String, ex: Throwable) {
universe@247 54 logger.log(Level.FINE, msg, ex)
universe@247 55 }
universe@247 56 fun warn(msg: String, ex: Throwable) {
universe@247 57 logger.log(Level.WARNING, msg, ex)
universe@247 58 }
universe@247 59 fun error(msg: String, ex: Throwable) {
universe@247 60 logger.log(Level.SEVERE, msg, ex)
universe@247 61 }
universe@247 62 fun trace(msg: String, ex: Throwable) {
universe@247 63 logger.log(Level.FINEST, msg, ex)
universe@247 64 }
universe@247 65 }

mercurial