本文整理汇总了Java中com.github.czyzby.kiwi.log.Logger类的典型用法代码示例。如果您正苦于以下问题:Java Logger类的具体用法?Java Logger怎么用?Java Logger使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Logger类属于com.github.czyzby.kiwi.log包,在下文中一共展示了Logger类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create
import com.github.czyzby.kiwi.log.Logger; //导入依赖的package包/类
@Override
public void create() {
// Changing logger factory:
MyLogger.setLoggerFactory();
// Preparing Autumn context:
final ContextInitializer initializer = new ContextInitializer();
// Manual component registration example - you can both let the Autumn find annotated classes for you or add
// some components manually:
final MyManualComponent manualComponent = new MyManualComponent();
initializer.addComponent(manualComponent);
// Registering platform-specific scanner. Starting to scan classes from Root:
initializer.scan(Root.class, scanner);
// Creating context:
destroyer = initializer.initiate();
// Getting a utility logger:
final Logger logger = LoggerService.forClass(Core.class);
// Testing events API (see com.github.czyzby.context.event package):
logger.info("Posting 'myMessage'.");
manualComponent.getMessageDispatcher().postMessage("myMessage");
logger.info("Posting MyEvent.");
manualComponent.getEventDispatcher().postEvent(new MyEvent("Core#create"));
// Final note, adding input listener:
logger.info("Autumn context is created. "
+ "Click to close the application and watch the console to see the destruction process.");
addInputProcessor();
// Getting utility assets injected into manualComponent by Autumn:
batch = manualComponent.getAssets().getBatch();
label = manualComponent.getLabel();
label.setText(message);
}
示例2: setLoggerFactory
import com.github.czyzby.kiwi.log.Logger; //导入依赖的package包/类
/** Changes the default Kiwi logger factory to provide {@link MyLogger} instances. After invoking this method,
* all created loggers will not only flood the console on info logs, but also update the message displayed on
* the main application screen. */
public static void setLoggerFactory() {
LoggerService.simpleClassNames(true); // We don't want to flood the logs with packages!
LoggerService.INSTANCE.setFactory(new LoggerFactory() {
@Override
public Logger newLogger(final LoggerService service, final Class<?> forClass) {
return new MyLogger(service, forClass);
}
});
}
示例3: provide
import com.github.czyzby.kiwi.log.Logger; //导入依赖的package包/类
@Override
public Logger provide(final Object target, final Member member) {
if (target != null) {
return getLogger(target.getClass());
} else if (member instanceof ConstructorMember) { // Extracting component class from constructor:
final ConstructorMember constructor = (ConstructorMember) member;
return getLogger(constructor.getConstructor().getDeclaringClass());
}
return getGlobalLogger();
}
示例4: newLogger
import com.github.czyzby.kiwi.log.Logger; //导入依赖的package包/类
@Override
public Logger newLogger(final LoggerService service, final Class<?> forClass) {
return new DefaultLogger(service, forClass);
}
示例5: newLogger
import com.github.czyzby.kiwi.log.Logger; //导入依赖的package包/类
@Override
public Logger newLogger(final LoggerService service, final Class<?> forClass) {
return new AsynchronousLogger(service, forClass);
}
示例6: getType
import com.github.czyzby.kiwi.log.Logger; //导入依赖的package包/类
@Override
public Class<? extends Logger> getType() {
return Logger.class;
}
示例7: getGlobalLogger
import com.github.czyzby.kiwi.log.Logger; //导入依赖的package包/类
/** @return {@link Logger} assigned to the current application listener implementation. Can be treated as global
* logger. */
public Logger getGlobalLogger() {
return getLogger(Gdx.app.getApplicationListener().getClass());
}
示例8: getLogger
import com.github.czyzby.kiwi.log.Logger; //导入依赖的package包/类
/** @param forClass will be included in the logs.
* @return a {@link Logger} instance unique to the selected class. */
public Logger getLogger(final Class<?> forClass) {
return LoggerService.forClass(forClass);
}