本文整理匯總了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());
}
}
}
示例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!");
}
}
示例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"));
}