From bb66465751b8f0b129e53e639854f95fcdb3dca8 Mon Sep 17 00:00:00 2001 From: Adam Juraszek Date: Tue, 14 May 2019 11:57:21 +0200 Subject: Custom log declaration --- src/core/lombok/ConfigurationKeys.java | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/core/lombok/ConfigurationKeys.java') diff --git a/src/core/lombok/ConfigurationKeys.java b/src/core/lombok/ConfigurationKeys.java index f70590f9..951b2893 100644 --- a/src/core/lombok/ConfigurationKeys.java +++ b/src/core/lombok/ConfigurationKeys.java @@ -25,6 +25,7 @@ import java.util.List; import lombok.core.configuration.CallSuperType; import lombok.core.configuration.ConfigurationKey; +import lombok.core.configuration.LogDeclaration; import lombok.core.configuration.FlagUsageType; import lombok.core.configuration.IdentifierName; import lombok.core.configuration.NullCheckExceptionType; @@ -428,6 +429,36 @@ public class ConfigurationKeys { */ public static final ConfigurationKey LOG_ANY_FIELD_IS_STATIC = new ConfigurationKey("lombok.log.fieldIsStatic", "Make the generated logger fields static (default: true).") {}; + // ----- Custom Logging ----- + + /** + * lombok configuration: {@code lombok.log.custom.flagUsage} = {@code WARNING} | {@code ERROR}. + * + * If set, any usage of {@code @CustomLog} results in a warning / error. + */ + public static final ConfigurationKey LOG_CUSTOM_FLAG_USAGE = new ConfigurationKey("lombok.log.custom.flagUsage", "Emit a warning or error if @CustomLog is used.") {}; + + /** + * lombok configuration: {@code lombok.log.custom.declaration} = <String: logDeclaration>. + * + * The log declaration must follow the pattern: + *
+ * {@code [LoggerType ]LoggerFactoryType.loggerFactoryMethod(loggerFactoryMethodParams)[(loggerFactoryMethodParams)]} + *
+ * It consists of: + *
    + *
  • Optional fully qualified logger type, e.g. {@code my.cool.Logger}, followed by space. If not specified, it defaults to the logger factory type. + *
  • Fully qualified logger factory type, e.g. {@code my.cool.LoggerFactory}, followed by dot. + *
  • Factory method, e.g. {@code createLogger}. The method must be defined on the logger factory type and must be static. + *
  • At least one definition of factory method parameters, e.g. {@code ()} or {@code (TOPIC,TYPE)}. The format is comma-separated list of parameters wrapped in parentheses. + * The allowed parameters are: {@code TYPE} | {@code NAME} | {@code TOPIC} | {@code NULL}. + * There can be at most one parameter definition with {@code TOPIC} and at most one without {@code TOPIC}. + *
+ * + * If not set, any usage of {@code @CustomLog} will result in an error. + */ + public static final ConfigurationKey LOG_CUSTOM_DECLARATION = new ConfigurationKey("lombok.log.custom.declaration", "Define the generated custom logger field.") {}; + // ##### Experimental ##### /** -- cgit