Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color pattern formatter #351

Merged
merged 1 commit into from
Mar 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,26 +1,9 @@
/*
* JBoss, Home of Professional Open Source.
*
* Copyright 2014 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.jboss.logmanager.formatters;

import org.jboss.logmanager.ExtLogRecord;

import java.util.logging.Formatter;

/**
* A single format step which handles some part of rendering a log record.
*/
Expand All @@ -41,7 +24,7 @@ public interface FormatStep {
* @param builder the string builder to append to
* @param record the record being rendered
*/
default void render(MultistepFormatter formatter, StringBuilder builder, ExtLogRecord record) {
default void render(Formatter formatter, StringBuilder builder, ExtLogRecord record) {
render(builder, record);
}

Expand All @@ -61,4 +44,58 @@ default void render(MultistepFormatter formatter, StringBuilder builder, ExtLogR
default boolean isCallerInformationRequired() {
return false;
}

/**
* Get the item type of this step.
*
* @return the item type
*/
default ItemType getItemType() {
return ItemType.GENERIC;
}

/**
* An enumeration of the types of items that can be rendered. Note that this enumeration may be expanded
* in the future, so unknown values should be handled gracefully as if {@link #GENERIC} were used.
*/
enum ItemType {
/** An item of unknown kind. */
GENERIC,

/** A compound step. */
COMPOUND,

// == // == //

/** A log level. */
LEVEL,

// == // == //

SOURCE_CLASS_NAME,
DATE,
SOURCE_FILE_NAME,
HOST_NAME,
SOURCE_LINE_NUMBER,
LINE_SEPARATOR,
CATEGORY,
MDC,
/**
* The log message without the exception trace.
*/
MESSAGE,
EXCEPTION_TRACE,
SOURCE_METHOD_NAME,
SOURCE_MODULE_NAME,
SOURCE_MODULE_VERSION,
NDC,
PROCESS_ID,
PROCESS_NAME,
RELATIVE_TIME,
RESOURCE_KEY,
SYSTEM_PROPERTY,
TEXT,
THREAD_ID,
THREAD_NAME,
}
}
Loading