murat8505 / projectlombok

Automatically exported from code.google.com/p/projectlombok
0 stars 1 forks source link

Add @Logger(factory=MyLoggerFactory.class) #808

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I would like a new logging annotation that could accept a factory class as a 
parameter, and would then generate the log field.

For example,
import com.mycompany.MyLoggerFactory;

@Logger(factory=MyLoggerFactory.class)
public class MyClass {
    public static void doStuff() {
        log.info("some stuff");
    }
}

would become
import com.mycompany.MyLoggerFactory;

public class MyClass {
    private static final java.util.logging.Logger log = com.mycompany.MyLoggerFactory.getLogger(MyClass.class);

    public static void doStuff() {
        log.info("some stuff");
    }
}

This would make it convenient to add custom loggers, in particular loggers that 
had custom methods on them that would allow for logging structured data.

Original issue reported on code.google.com by Robot.Ni...@gmail.com on 1 May 2015 at 8:00

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I just noticed that the output example is wrong. It should be

import com.mycompany.MyLoggerFactory;

public class MyClass {
    private static final MyLogger log = com.mycompany.MyLoggerFactory.getLogger(MyClass.class);

    public static void doStuff() {
        log.info("some stuff");
    }
}

where MyLogger is the return type of getLogger.

Original comment by Robot.Ni...@gmail.com on 27 May 2015 at 7:22