following
public class Testclass {
private static final LogExtension log = new LogExtension(Testclass.class);
}
should work with just:
@LogExtension
public class Testclass{}
similar to @Slf4j with its annotation it creates an object like in all the classes where it is used.
private static final org.slf4j.Logger internalLog = org.slf4j.LoggerFactory.getLogger(LogExtension.class);
any help will be much appreciated.. thanks for reading. couldn't find much on the internet about how to do it.
I'm trying to create a annotation like
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.SOURCE)
@interface LogExt{
LogExtension log() default new LogExtension();
}
but how to get the class type as default to create object of LogExtension ? to make it work like :
private static final LogExtension log = new LogExtension(Testclass.class);
Scenario: I'm trying to have a Logger class that can replace SLF4j as per my problem so it Like I want to create a custom annotation like @LogExtension similar to @slf4j which can execute on compile-time to produce