diff --git a/logging/src/main/kotlin/de/staropensource/engine/logging/Filterer.kt b/logging/src/main/kotlin/de/staropensource/engine/logging/Filterer.kt index c194d00..cd8dc64 100644 --- a/logging/src/main/kotlin/de/staropensource/engine/logging/Filterer.kt +++ b/logging/src/main/kotlin/de/staropensource/engine/logging/Filterer.kt @@ -20,7 +20,7 @@ package de.staropensource.engine.logging -import de.staropensource.engine.logging.type.Filter +import de.staropensource.engine.logging.implementable.Filter import de.staropensource.engine.logging.type.Call /** diff --git a/logging/src/main/kotlin/de/staropensource/engine/logging/LoggerConfiguration.kt b/logging/src/main/kotlin/de/staropensource/engine/logging/LoggerConfiguration.kt index 14a5fd2..92216a9 100644 --- a/logging/src/main/kotlin/de/staropensource/engine/logging/LoggerConfiguration.kt +++ b/logging/src/main/kotlin/de/staropensource/engine/logging/LoggerConfiguration.kt @@ -23,7 +23,7 @@ package de.staropensource.engine.logging import de.staropensource.engine.logging.implementation.SOSLSv2FormatBuilder import de.staropensource.engine.logging.type.ChannelSettings import de.staropensource.engine.logging.type.Feature -import de.staropensource.engine.logging.type.FormatBuilder +import de.staropensource.engine.logging.implementable.FormatBuilder import de.staropensource.engine.logging.type.Level import de.staropensource.engine.logging.type.OperationMode import kotlinx.datetime.TimeZone diff --git a/logging/src/main/kotlin/de/staropensource/engine/logging/Processor.kt b/logging/src/main/kotlin/de/staropensource/engine/logging/Processor.kt index 61166a1..4c6f0b6 100644 --- a/logging/src/main/kotlin/de/staropensource/engine/logging/Processor.kt +++ b/logging/src/main/kotlin/de/staropensource/engine/logging/Processor.kt @@ -26,7 +26,7 @@ import de.staropensource.engine.logging.implementation.SOSLSv2FormatBuilder import de.staropensource.engine.logging.type.Call import de.staropensource.engine.logging.type.ChannelSettings import de.staropensource.engine.logging.type.Feature -import de.staropensource.engine.logging.type.FormatBuilder +import de.staropensource.engine.logging.implementable.FormatBuilder import de.staropensource.engine.logging.type.OperationMode import kotlin.reflect.full.primaryConstructor @@ -75,8 +75,8 @@ class Processor private constructor() { * following steps: * 1. build the log format * 2. update message - * 3. format the finalized format using the configured [de.staropensource.engine.logging.type.Formatter] - * 4. pass the finalized format to the configured [de.staropensource.engine.logging.type.Adapter]. + * 3. format the finalized format using the configured [de.staropensource.engine.logging.implementable.Formatter] + * 4. pass the finalized format to the configured [de.staropensource.engine.logging.implementable.Adapter]. * * Invoked by the configured * [ThreadingHandler]. diff --git a/logging/src/main/kotlin/de/staropensource/engine/logging/type/Adapter.kt b/logging/src/main/kotlin/de/staropensource/engine/logging/implementable/Adapter.kt similarity index 86% rename from logging/src/main/kotlin/de/staropensource/engine/logging/type/Adapter.kt rename to logging/src/main/kotlin/de/staropensource/engine/logging/implementable/Adapter.kt index 3142268..d19a442 100644 --- a/logging/src/main/kotlin/de/staropensource/engine/logging/type/Adapter.kt +++ b/logging/src/main/kotlin/de/staropensource/engine/logging/implementable/Adapter.kt @@ -18,7 +18,9 @@ * along with this program. If not, see . */ -package de.staropensource.engine.logging.type +package de.staropensource.engine.logging.implementable + +import de.staropensource.engine.logging.type.Call /** * Handles processed log calls. @@ -29,7 +31,7 @@ interface Adapter { /** * Handles the processed log call. * - * @param call original [Call] + * @param call original [de.staropensource.engine.logging.type.Call] * @param format finalized log format (print this!) * @since v1-alpha10 */ diff --git a/logging/src/main/kotlin/de/staropensource/engine/logging/type/Filter.kt b/logging/src/main/kotlin/de/staropensource/engine/logging/implementable/Filter.kt similarity index 92% rename from logging/src/main/kotlin/de/staropensource/engine/logging/type/Filter.kt rename to logging/src/main/kotlin/de/staropensource/engine/logging/implementable/Filter.kt index ff73174..e51bc4b 100644 --- a/logging/src/main/kotlin/de/staropensource/engine/logging/type/Filter.kt +++ b/logging/src/main/kotlin/de/staropensource/engine/logging/implementable/Filter.kt @@ -18,7 +18,9 @@ * along with this program. If not, see . */ -package de.staropensource.engine.logging.type +package de.staropensource.engine.logging.implementable + +import de.staropensource.engine.logging.type.Call /** * Provides methods for filtering log calls. diff --git a/logging/src/main/kotlin/de/staropensource/engine/logging/implementable/FormatBuilder.kt b/logging/src/main/kotlin/de/staropensource/engine/logging/implementable/FormatBuilder.kt new file mode 100644 index 0000000..bef69a8 --- /dev/null +++ b/logging/src/main/kotlin/de/staropensource/engine/logging/implementable/FormatBuilder.kt @@ -0,0 +1,84 @@ +/* + * STAROPENSOURCE ENGINE SOURCE FILE + * Copyright (c) 2024 The StarOpenSource Engine Authors + * Licensed under the GNU Affero General Public License v3 + * with an exception allowing classpath linking. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.staropensource.engine.logging.implementable + +import de.staropensource.engine.logging.type.Call +import de.staropensource.engine.logging.type.Feature + +/** + * Builds log formats. + * + * @param call [de.staropensource.engine.logging.type.Call] to build a format for + * @since v1-alpha10 + */ +abstract class FormatBuilder(protected val call: Call) { + /** + * Contains all enabled features. + * + * @since v1-alpha10 + */ + protected val enabledFeatures: MutableSet = mutableSetOf() + + /** + * Contains the message. + * + * @since v1-alpha10 + */ + var message: String = "no message has been defined, this is a bug" + + /** + * Returns a set of all enabled enabledFeatures. + * + * @return set of enabled enabledFeatures + * @since v1-alpha10 + */ + fun getFeatures(): Set { + return enabledFeatures.toSet() + } + + /** + * Adds the specified feature to the format. + * + * @param feature feature to add + * @since v1-alpha10 + */ + fun addFeature(feature: Feature) { + enabledFeatures.add(feature) + } + + /** + * Removes the specified feature from the format. + * + * @param feature feature to remove + * @since v1-alpha10 + */ + fun removeFeature(feature: Feature) { + enabledFeatures.remove(feature) + } + + /** + * Returns the finalized format. + * + * @return finalized format + * @since v1-alpha10 + */ + abstract override fun toString(): String +} diff --git a/logging/src/main/kotlin/de/staropensource/engine/logging/type/Formatter.kt b/logging/src/main/kotlin/de/staropensource/engine/logging/implementable/Formatter.kt similarity index 97% rename from logging/src/main/kotlin/de/staropensource/engine/logging/type/Formatter.kt rename to logging/src/main/kotlin/de/staropensource/engine/logging/implementable/Formatter.kt index f0040f4..1a67f05 100644 --- a/logging/src/main/kotlin/de/staropensource/engine/logging/type/Formatter.kt +++ b/logging/src/main/kotlin/de/staropensource/engine/logging/implementable/Formatter.kt @@ -18,7 +18,7 @@ * along with this program. If not, see . */ -package de.staropensource.engine.logging.type +package de.staropensource.engine.logging.implementable /** * Provides log format formatting. diff --git a/logging/src/main/kotlin/de/staropensource/engine/logging/type/OneCycleFormatter.kt b/logging/src/main/kotlin/de/staropensource/engine/logging/implementable/OneCycleFormatter.kt similarity index 97% rename from logging/src/main/kotlin/de/staropensource/engine/logging/type/OneCycleFormatter.kt rename to logging/src/main/kotlin/de/staropensource/engine/logging/implementable/OneCycleFormatter.kt index 848f15b..7fe638f 100644 --- a/logging/src/main/kotlin/de/staropensource/engine/logging/type/OneCycleFormatter.kt +++ b/logging/src/main/kotlin/de/staropensource/engine/logging/implementable/OneCycleFormatter.kt @@ -18,7 +18,7 @@ * along with this program. If not, see . */ -package de.staropensource.engine.logging.type +package de.staropensource.engine.logging.implementable /** * Performs message formatting in one cycle. diff --git a/logging/src/main/kotlin/de/staropensource/engine/logging/type/TwoCycleFormatter.kt b/logging/src/main/kotlin/de/staropensource/engine/logging/implementable/TwoCycleFormatter.kt similarity index 97% rename from logging/src/main/kotlin/de/staropensource/engine/logging/type/TwoCycleFormatter.kt rename to logging/src/main/kotlin/de/staropensource/engine/logging/implementable/TwoCycleFormatter.kt index 2a28894..c7f6546 100644 --- a/logging/src/main/kotlin/de/staropensource/engine/logging/type/TwoCycleFormatter.kt +++ b/logging/src/main/kotlin/de/staropensource/engine/logging/implementable/TwoCycleFormatter.kt @@ -18,7 +18,7 @@ * along with this program. If not, see . */ -package de.staropensource.engine.logging.type +package de.staropensource.engine.logging.implementable /** * Performs message formatting in two cycles. diff --git a/logging/src/main/kotlin/de/staropensource/engine/logging/implementable/package-info.kt b/logging/src/main/kotlin/de/staropensource/engine/logging/implementable/package-info.kt new file mode 100644 index 0000000..bcdf4ec --- /dev/null +++ b/logging/src/main/kotlin/de/staropensource/engine/logging/implementable/package-info.kt @@ -0,0 +1,26 @@ +/* + * STAROPENSOURCE ENGINE SOURCE FILE + * Copyright (c) 2024 The StarOpenSource Engine Authors + * Licensed under the GNU Affero General Public License v3 + * with an exception allowing classpath linking. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +/** + * Interfaces and abstract classes. + * + * @since v1-alpha10 + */ +package de.staropensource.engine.logging.implementable diff --git a/logging/src/main/kotlin/de/staropensource/engine/logging/implementation/NoOperationFormatter.kt b/logging/src/main/kotlin/de/staropensource/engine/logging/implementation/NoOperationFormatter.kt index d3d37d4..79eba3f 100644 --- a/logging/src/main/kotlin/de/staropensource/engine/logging/implementation/NoOperationFormatter.kt +++ b/logging/src/main/kotlin/de/staropensource/engine/logging/implementation/NoOperationFormatter.kt @@ -20,7 +20,7 @@ package de.staropensource.engine.logging.implementation -import de.staropensource.engine.logging.type.OneCycleFormatter +import de.staropensource.engine.logging.implementable.OneCycleFormatter /** * Swallows all formatting tags diff --git a/logging/src/main/kotlin/de/staropensource/engine/logging/implementation/PrintlnAdapter.kt b/logging/src/main/kotlin/de/staropensource/engine/logging/implementation/PrintlnAdapter.kt index 39291c9..1c8a12f 100644 --- a/logging/src/main/kotlin/de/staropensource/engine/logging/implementation/PrintlnAdapter.kt +++ b/logging/src/main/kotlin/de/staropensource/engine/logging/implementation/PrintlnAdapter.kt @@ -20,7 +20,7 @@ package de.staropensource.engine.logging.implementation -import de.staropensource.engine.logging.type.Adapter +import de.staropensource.engine.logging.implementable.Adapter import de.staropensource.engine.logging.type.Call /** diff --git a/logging/src/main/kotlin/de/staropensource/engine/logging/implementation/SOSLSv2FormatBuilder.kt b/logging/src/main/kotlin/de/staropensource/engine/logging/implementation/SOSLSv2FormatBuilder.kt index da6df9f..304fc9e 100644 --- a/logging/src/main/kotlin/de/staropensource/engine/logging/implementation/SOSLSv2FormatBuilder.kt +++ b/logging/src/main/kotlin/de/staropensource/engine/logging/implementation/SOSLSv2FormatBuilder.kt @@ -24,7 +24,7 @@ import de.staropensource.engine.logging.Logger import de.staropensource.engine.logging.LoggerConfiguration import de.staropensource.engine.logging.type.Call import de.staropensource.engine.logging.type.Feature -import de.staropensource.engine.logging.type.FormatBuilder +import de.staropensource.engine.logging.implementable.FormatBuilder import de.staropensource.engine.logging.type.Level import kotlinx.datetime.Clock import kotlinx.datetime.LocalDateTime diff --git a/logging/src/main/kotlin/de/staropensource/engine/logging/implementation/TwoCycleFormatterImpl.kt b/logging/src/main/kotlin/de/staropensource/engine/logging/implementation/TwoCycleFormatterImpl.kt index 015b746..5bf7407 100644 --- a/logging/src/main/kotlin/de/staropensource/engine/logging/implementation/TwoCycleFormatterImpl.kt +++ b/logging/src/main/kotlin/de/staropensource/engine/logging/implementation/TwoCycleFormatterImpl.kt @@ -20,7 +20,7 @@ package de.staropensource.engine.logging.implementation -import de.staropensource.engine.logging.type.TwoCycleFormatter +import de.staropensource.engine.logging.implementable.TwoCycleFormatter /** * A [TwoCycleFormatter] implementation providing @@ -40,7 +40,7 @@ import de.staropensource.engine.logging.type.TwoCycleFormatter * - `ATTRIBUTE:` (example `ATTRIBUTE:BOLD`) * * @see TwoCycleFormatter - * @see de.staropensource.engine.logging.type.Formatter + * @see de.staropensource.engine.logging.implementable.Formatter * @since v1-alpha10 */ abstract class TwoCycleFormatterImpl: TwoCycleFormatter() { diff --git a/logging/src/main/kotlin/de/staropensource/engine/logging/type/ChannelSettings.kt b/logging/src/main/kotlin/de/staropensource/engine/logging/type/ChannelSettings.kt index 80a962b..469cbd9 100644 --- a/logging/src/main/kotlin/de/staropensource/engine/logging/type/ChannelSettings.kt +++ b/logging/src/main/kotlin/de/staropensource/engine/logging/type/ChannelSettings.kt @@ -1,5 +1,7 @@ package de.staropensource.engine.logging.type +import de.staropensource.engine.logging.implementable.Adapter +import de.staropensource.engine.logging.implementable.Formatter import de.staropensource.engine.logging.implementation.NoOperationFormatter import de.staropensource.engine.logging.implementation.PrintlnAdapter diff --git a/logging/src/main/kotlin/de/staropensource/engine/logging/type/FormatBuilder.kt b/logging/src/main/kotlin/de/staropensource/engine/logging/type/FormatBuilder.kt index 1f7cc1d..978735d 100644 --- a/logging/src/main/kotlin/de/staropensource/engine/logging/type/FormatBuilder.kt +++ b/logging/src/main/kotlin/de/staropensource/engine/logging/type/FormatBuilder.kt @@ -20,62 +20,3 @@ package de.staropensource.engine.logging.type -/** - * Builds log formats. - * - * @param call [Call] to build a format for - * @since v1-alpha10 - */ -abstract class FormatBuilder(protected val call: Call) { - /** - * Contains all enabled features. - * - * @since v1-alpha10 - */ - protected val enabledFeatures: MutableSet = mutableSetOf() - - /** - * Contains the message. - * - * @since v1-alpha10 - */ - var message: String = "no message has been defined, this is a bug" - - /** - * Returns a set of all enabled enabledFeatures. - * - * @return set of enabled enabledFeatures - * @since v1-alpha10 - */ - fun getFeatures(): Set { - return enabledFeatures.toSet() - } - - /** - * Adds the specified feature to the format. - * - * @param feature feature to add - * @since v1-alpha10 - */ - fun addFeature(feature: Feature) { - enabledFeatures.add(feature) - } - - /** - * Removes the specified feature from the format. - * - * @param feature feature to remove - * @since v1-alpha10 - */ - fun removeFeature(feature: Feature) { - enabledFeatures.remove(feature) - } - - /** - * Returns the finalized format. - * - * @return finalized format - * @since v1-alpha10 - */ - abstract override fun toString(): String -}