Move logger interfaces and classes to correct pkg
This commit is contained in:
parent
e6b5ead361
commit
ae5ba252a5
16 changed files with 132 additions and 75 deletions
|
@ -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
|
||||
|
||||
/**
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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].
|
||||
|
|
|
@ -18,7 +18,9 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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
|
||||
*/
|
|
@ -18,7 +18,9 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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.
|
|
@ -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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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<Feature> = mutableSetOf<Feature>()
|
||||
|
||||
/**
|
||||
* 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<Feature> {
|
||||
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
|
||||
}
|
|
@ -18,7 +18,7 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.staropensource.engine.logging.type
|
||||
package de.staropensource.engine.logging.implementable
|
||||
|
||||
/**
|
||||
* Provides log format formatting.
|
|
@ -18,7 +18,7 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.staropensource.engine.logging.type
|
||||
package de.staropensource.engine.logging.implementable
|
||||
|
||||
/**
|
||||
* Performs message formatting in one cycle.
|
|
@ -18,7 +18,7 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.staropensource.engine.logging.type
|
||||
package de.staropensource.engine.logging.implementable
|
||||
|
||||
/**
|
||||
* Performs message formatting in two cycles.
|
|
@ -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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Interfaces and abstract classes.
|
||||
*
|
||||
* @since v1-alpha10
|
||||
*/
|
||||
package de.staropensource.engine.logging.implementable
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
/**
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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<Feature> = mutableSetOf<Feature>()
|
||||
|
||||
/**
|
||||
* 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<Feature> {
|
||||
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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue