当前位置: 首页>>代码示例>>Java>>正文


Java LogFactory类代码示例

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


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

示例1: onSetup

import org.cubeengine.logscribe.LogFactory; //导入依赖的package包/类
@Listener
public void onSetup(GamePreInitializationEvent event)
{
    cm.getProviders().getExceptionHandler().addHandler(new RolesExceptionHandler(i18n));
    this.permLogger = factory.getLog(LogFactory.class, "Permissions");
    ThreadFactory threadFactory = mm.getThreadFactory(Roles.class);
    this.permLogger.addTarget(
            new AsyncFileTarget.Builder(LoggingUtil.getLogFile(fm, "Permissions").toPath(),
                    LoggingUtil.getFileFormat(false, true)
            ).setAppend(true).setCycler(LoggingUtil.getCycler()).setThreadFactory(threadFactory).build());

    Optional<PermissionService> previous = Sponge.getServiceManager().provide(PermissionService.class);
    Sponge.getServiceManager().setProvider(plugin.getInstance().get(), PermissionService.class, service);
    if (previous.isPresent())
    {
        if (!previous.get().getClass().getName().equals(RolesPermissionService.class.getName()))
        {
            this.service.getLog().info("Replaced existing Permission Service: {}", previous.get().getClass().getName());
        }
    }
}
 
开发者ID:CubeEngine,项目名称:modules-main,代码行数:22,代码来源:Roles.java

示例2: ApiServer

import org.cubeengine.logscribe.LogFactory; //导入依赖的package包/类
@Inject
public ApiServer(LogFactory logFactory, FileManager fm, ModuleManager mm)
{
    this.logger = mm.getLoggerFor(ApiServer.class);
    this.moduleFolder = mm.getPathFor(ApiServer.class);
    this.tf = mm.getThreadFactory(this.getClass());
    this.log = logFactory.getLog(ApiServer.class, "WebAPI");
    this.mm = mm;
    this.log.addTarget(
            new AsyncFileTarget.Builder(LoggingUtil.getLogFile(fm, "WebAPI").toPath(),
                    LoggingUtil.getFileFormat(true, true)
                    ).setAppend(true).setCycler(LoggingUtil.getCycler()).setThreadFactory(tf).build());
    // TODO this.log.addTarget(new LogProxyTarget(logFactory.getParent()));
    try
    {
        this.bindAddress.set(InetAddress.getLocalHost());
    }
    catch (UnknownHostException ignored)
    {
        this.log.warn("Failed to get the localhost!");
    }
}
 
开发者ID:CubeEngine,项目名称:modules-extra,代码行数:23,代码来源:ApiServer.java

示例3: MySQLDatabase

import org.cubeengine.logscribe.LogFactory; //导入依赖的package包/类
@Inject
public MySQLDatabase(Reflector reflector, ModuleManager mm, FileManager fm, LogFactory logFactory)
{
    this.mm = mm;
    this.mm.registerBinding(Database.class, this);
    File pluginFolder = mm.getBasePath();

    // Disable HikariPool Debug ConsoleSpam
    ((Logger)LogManager.getLogger(HikariPool.class)).setLevel(Level.INFO);
    ((Logger)LogManager.getLogger("com.zaxxer.hikari.pool.PoolBase")).setLevel(Level.INFO); // really? now pkg-private
    ((Logger)LogManager.getLogger(HikariConfig.class)).setLevel(Level.INFO);

    // Setting up Logger...
    this.logger = mm.getLoggerFor(Database.class);
    AsyncFileTarget target =
            new AsyncFileTarget.Builder(LoggingUtil.getLogFile(fm, "Database").toPath(),
                    LoggingUtil.getFileFormat(true, false)
            ).setAppend(true).setCycler(LoggingUtil.getCycler()).setThreadFactory(threadFactory).build();

    target.setLevel(LogLevel.DEBUG);
    logger.addTarget(target);


    LogTarget parentTarget = logger.addDelegate(logFactory.getLog(LogFactory.class));
    parentTarget.appendFilter(new PrefixFilter("[DB] "));
    parentTarget.setLevel(LogLevel.INFO);


    this.config = reflector.load(MySQLDatabaseConfiguration.class, new File(pluginFolder, "database.yml"));


}
 
开发者ID:CubeEngine,项目名称:modules-main,代码行数:33,代码来源:MySQLDatabase.java


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