• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ILogger类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.metaborg.util.log.ILogger的典型用法代码示例。如果您正苦于以下问题:Java ILogger类的具体用法?Java ILogger怎么用?Java ILogger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ILogger类属于org.metaborg.util.log包,在下文中一共展示了ILogger类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: hear

import org.metaborg.util.log.ILogger; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public final <I> void hear(
        final TypeLiteral<I> typeLiteral,
        final TypeEncounter<I> typeEncounter) {
    Preconditions.checkNotNull(typeLiteral);
    Preconditions.checkNotNull(typeEncounter);

    // Go through the class and its ancestors to find fields like this:
    //     @InjectLogger private Logger logger;

    Class<?> clazz = typeLiteral.getRawType();
    while (clazz != null) {
        for (final Field field : clazz.getDeclaredFields()) {
            if (field.getType() == ILogger.class &&
                    field.isAnnotationPresent(InjectLogger.class)) {
                typeEncounter.register(new MetaborgLoggerMembersInjector<>(field));
            }
        }
        clazz = clazz.getSuperclass();
    }
}
 
开发者ID:metaborg,项目名称:spoofax-intellij,代码行数:25,代码来源:MetaborgLoggerTypeListener.java


示例2: injectLogger

import org.metaborg.util.log.ILogger; //导入依赖的package包/类
/**
 * Injects the specified logger into the specified object.
 *
 * Fields with the @InjectLogger annotation will be injected.
 * If injection fails, the field is not injected.
 *
 * Use this function only when Guice is not available to inject the logger
 * (e.g. in unit tests).
 *
 * @param obj The object instance to inject into.
 * @param logger The logger to inject.
 * @return The object instance.
 */
public static <T> T injectLogger(final T obj, final ILogger logger) {
    @Nullable Class<?> clazz = obj.getClass();
    while (clazz != null) {
        for (final Field loggerField : getLoggerFields(clazz)) {
            try {
                loggerField.setAccessible(true);
                loggerField.set(obj, logger);
            } catch (final Exception ex) {
                // Ignore any exceptions.
            }
        }
        // Set the logger in the super class.
        clazz = clazz.getSuperclass();
    }
    return obj;
}
 
开发者ID:metaborg,项目名称:spoofax-intellij,代码行数:30,代码来源:LoggerUtils2.java


示例3: TypesmartTermFactory

import org.metaborg.util.log.ILogger; //导入依赖的package包/类
public TypesmartTermFactory(ITermFactory baseFactory, ILogger logger, TypesmartContext context) {
    super(baseFactory.getDefaultStorageType(), baseFactory);
    assert baseFactory
        .getDefaultStorageType() == IStrategoTerm.MUTABLE : "Typesmart factory needs to have a factory with MUTABLE terms";
    this.baseFactory = baseFactory;
    this.logger = logger;
    this.context = context;
}
 
开发者ID:metaborg,项目名称:mb-rep,代码行数:9,代码来源:TypesmartTermFactory.java


示例4: StreamMessagePrinter

import org.metaborg.util.log.ILogger; //导入依赖的package包/类
public StreamMessagePrinter(ISourceTextService sourceTextService, boolean printHighlight, boolean printExceptions,
    ILogger logger) {
    this(sourceTextService, printHighlight, printExceptions, LoggerUtils.stream(logger, Level.Info),
        LoggerUtils.stream(logger, Level.Warn), LoggerUtils.stream(logger, Level.Error));
}
 
开发者ID:metaborg,项目名称:spoofax,代码行数:6,代码来源:StreamMessagePrinter.java


示例5: getLogger

import org.metaborg.util.log.ILogger; //导入依赖的package包/类
@Override
public ILogger getLogger() {
    return logger;
}
 
开发者ID:metaborg,项目名称:spoofax,代码行数:5,代码来源:LoggingTestReporterService.java


示例6: getLogger

import org.metaborg.util.log.ILogger; //导入依赖的package包/类
@Override
public ILogger getLogger() {
    return this.logger;
}
 
开发者ID:metaborg,项目名称:spoofax,代码行数:5,代码来源:TeamCityTestReporterService.java


示例7: logException

import org.metaborg.util.log.ILogger; //导入依赖的package包/类
/**
 * Logs the exception.
 *
 * @param logger The logger.
 * @param throwable The exception.
 */
private static <T extends Throwable> T logException(final ILogger logger, final T throwable) {

    logger.error(throwable.getMessage(), throwable);

    return throwable;
}
 
开发者ID:metaborg,项目名称:spoofax-intellij,代码行数:13,代码来源:LoggerUtils2.java


示例8: exception

import org.metaborg.util.log.ILogger; //导入依赖的package包/类
/**
 * Creates an exception and logs it as an error.
 *
 * @param logger The logger to use.
 * @param exceptionClass The class of exception to create.
 * @param msg The exception message.
 * @param t The throwable that caused the exception.
 * @param <T> The type of exception.
 * @return The exception object.
 */
public static <T extends Throwable> T exception(final ILogger logger,
                                                final Class<T> exceptionClass,
                                                final String msg,
                                                @Nullable final Throwable t) {

    return logException(logger, ExceptionUtils.exception(exceptionClass, msg, t));
}
 
开发者ID:metaborg,项目名称:spoofax-intellij,代码行数:18,代码来源:LoggerUtils2.java


示例9: createLogger

import org.metaborg.util.log.ILogger; //导入依赖的package包/类
/**
 * Creates the logger.
 *
 * @param clazz The class.
 * @return The created logger instance.
 */
private static ILogger createLogger(final Class<?> clazz) {
    return LoggerUtils.logger(clazz);
}
 
开发者ID:metaborg,项目名称:spoofax-intellij,代码行数:10,代码来源:MetaborgLoggerMembersInjector.java


示例10: getLogger

import org.metaborg.util.log.ILogger; //导入依赖的package包/类
/**
 * Gets a logger to which the test output may be logged.
 *
 * @return A logger.
 */
ILogger getLogger();
 
开发者ID:metaborg,项目名称:spoofax,代码行数:7,代码来源:ITestReporterService.java



注:本文中的org.metaborg.util.log.ILogger类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PanelDefinition类代码示例发布时间:2022-05-23
下一篇:
Java Attribute类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap