or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

builder-pattern.mdconstructors.mddata-classes.mdexperimental.mdimmutable-patterns.mdindex.mdlogging.mdobject-methods.mdproperty-access.mdtype-inference.mdutilities.md
tile.json

logging.mddocs/

Logging

Seamless integration with popular Java logging frameworks through automatic logger field generation.

Capabilities

SLF4J Integration

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.SOURCE)
public @interface Slf4j {
    String topic() default "";
}

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.SOURCE)
public @interface XSlf4j {
    String topic() default "";
}

Log4j Integration

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.SOURCE)
public @interface Log4j {
    String topic() default "";
}

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.SOURCE)
public @interface Log4j2 {
    String topic() default "";
}

Other Logging Frameworks

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.SOURCE)
public @interface Log {  // Java Util Logging
    String topic() default "";
}

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.SOURCE)
public @interface CommonsLog {  // Apache Commons Logging
    String topic() default "";
}

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.SOURCE)
public @interface JBossLog {  // JBoss Logging
    String topic() default "";
}

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.SOURCE)
public @interface Flogger {  // Google Flogger
}

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.SOURCE)
public @interface CustomLog {
    String topic() default "";
}

Usage Examples:

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class UserService {
    public void createUser(String name) {
        log.info("Creating user: {}", name);
        // Implementation
        log.debug("User created successfully");
    }
}

// Generated field:
// private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(UserService.class);

Log4j2 Example:

import lombok.extern.log4j.Log4j2;

@Log4j2
public class PaymentProcessor {
    public void processPayment(double amount) {
        log.info("Processing payment of ${}", amount);
        try {
            // Payment processing logic
            log.debug("Payment processed successfully");
        } catch (Exception e) {
            log.error("Payment processing failed", e);
        }
    }
}

// Generated field:
// private static final org.apache.logging.log4j.Logger log = org.apache.logging.log4j.LogManager.getLogger(PaymentProcessor.class);

Java Util Logging Example:

import lombok.extern.java.Log;

@Log
public class FileManager {
    public void saveFile(String filename) {
        log.info("Saving file: " + filename);
        // Implementation
        log.fine("File saved successfully");
    }
}

// Generated field:
// private static final java.util.logging.Logger log = java.util.logging.Logger.getLogger(FileManager.class.getName());

Custom Topic Example:

import lombok.extern.slf4j.Slf4j;

@Slf4j(topic = "AUDIT")
public class AuditService {  
    public void auditAction(String action) {
        log.info("Audit: {}", action);
    }
}

// Generated field:
// private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger("AUDIT");