本文整理汇总了Java中io.vertx.core.logging.Logger类的典型用法代码示例。如果您正苦于以下问题:Java Logger类的具体用法?Java Logger怎么用?Java Logger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Logger类属于io.vertx.core.logging包,在下文中一共展示了Logger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fetchWithRetry
import io.vertx.core.logging.Logger; //导入依赖的package包/类
<T> void fetchWithRetry(Logger logger, Callable<T> blockingHandler, Future<T> done) {
vertx.executeBlocking((Future<T> fut) -> {
try {
fut.complete(blockingHandler.call());
} catch (Exception e) {
fut.fail(e);
}
}, ar -> {
if (ar.failed() && !(ar.cause() instanceof AcmeRetryAfterException)) {
done.fail(ar.cause());
return;
}
if (ar.succeeded() && ar.result() != null) {
done.complete(ar.result());
return;
}
long nextSleep = ar.succeeded() ? 3000 : ((AcmeRetryAfterException) ar.cause()).getRetryAfter().getTime() - currentTimeMillis();
logger.info("Recheck in {}ms @ {}", nextSleep, new Date(System.currentTimeMillis() + nextSleep));
vertx.setTimer(nextSleep, timerId -> fetchWithRetry(logger, blockingHandler, done));
});
}
示例2: init
import io.vertx.core.logging.Logger; //导入依赖的package包/类
public void init(String[] args, Handler<AsyncResult<Vertx>> fut) {
final Logger logger = OkapiLogger.get();
if (args.length < 1) {
fut.handle(Future.failedFuture("Missing command; use help"));
return;
}
if (parseOptions(args, fut)) {
return;
}
final String mode = conf.getString("mode", "dev");
switch (mode) {
case "dev":
case "initdatabase":
case "purgedatabase":
deploy(new MainVerticle(), conf, Vertx.vertx(vopt), fut);
break;
case "cluster":
case "proxy":
case "deployment":
deployClustered(logger, fut);
break;
default:
fut.handle(Future.failedFuture("Unknown command '" + mode + "'"));
}
}
示例3: apply
import io.vertx.core.logging.Logger; //导入依赖的package包/类
@Override
public Statement apply(Statement base, Description description) {
return new Statement() {
@Override
public void evaluate() throws Throwable {
vertx = createVertx.get();
try {
Context context = vertx != null ? vertx.getOrCreateContext() : null;
VertxUnitRunner.pushContext(context);
base.evaluate();
} finally {
VertxUnitRunner.popContext();
CountDownLatch latch = new CountDownLatch(1);
closeVertx.accept(vertx, latch);
try {
if (!latch.await(30 * 1000, TimeUnit.MILLISECONDS)) {
Logger logger = LoggerFactory.getLogger(description.getTestClass());
logger.warn("Could not close Vert.x in tme");
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
}
};
}
示例4: main
import io.vertx.core.logging.Logger; //导入依赖的package包/类
public static void main(String[] args) {
MainDeploy d = new MainDeploy();
d.init(args, res -> {
if (res.failed()) {
Logger logger = OkapiLogger.get();
logger.error(res.cause());
exit(1);
}
});
}
示例5: PostgresHandle
import io.vertx.core.logging.Logger; //导入依赖的package包/类
public PostgresHandle(Vertx vertx, JsonObject conf) {
JsonObject pgconf = new JsonObject();
String val;
val = Config.getSysConf("postgres_host", "", conf);
if (!val.isEmpty()) {
pgconf.put("host", val);
}
val = Config.getSysConf("postgres_port", "", conf);
Logger logger = OkapiLogger.get();
if (!val.isEmpty()) {
try {
Integer x = Integer.parseInt(val);
pgconf.put("port", x);
} catch (NumberFormatException e) {
logger.warn("Bad postgres_port value: " + val + ": " + e.getMessage());
}
}
val = Config.getSysConf("postgres_username", Config.getSysConf("postgres_user", "okapi", conf), conf);
if (!val.isEmpty()) {
pgconf.put("username", val);
}
val = Config.getSysConf("postgres_password", "okapi25", conf);
if (!val.isEmpty()) {
pgconf.put("password", val);
}
val = Config.getSysConf("postgres_database", "okapi", conf);
if (!val.isEmpty()) {
pgconf.put("database", val);
}
logger.debug("Connecting to postgres with " + pgconf.encode());
cli = PostgreSQLClient.createNonShared(vertx, pgconf);
logger.debug("created");
}
示例6: AsyncFileWriterImpl
import io.vertx.core.logging.Logger; //导入依赖的package包/类
public AsyncFileWriterImpl(long startPosition, WriteQueueSupport<AsyncFileWriter> writeQueueSupport, Context context, AsynchronousFileChannel dataFile, Logger log) {
this.log = log;
this.startPosition = startPosition;
this.writePos = startPosition;
this.ch = dataFile;
this.context = context;
this.writeQueueSupport = writeQueueSupport;
this.lastWriteTime = System.currentTimeMillis();
}
示例7: AsyncFileReaderImpl
import io.vertx.core.logging.Logger; //导入依赖的package包/类
public AsyncFileReaderImpl(Context context, long startPosition, int bufferSize, long length, AsynchronousFileChannel dataFile, Logger log) {
this.log = log;
this.bufferSize = bufferSize;
this.readPos = startPosition;
this.bytesRemaining = length;
this.startPosition = startPosition;
this.ch = dataFile;
this.context = context;
}
示例8: logIfFailed
import io.vertx.core.logging.Logger; //导入依赖的package包/类
static <T> Handler<AsyncResult<T>> logIfFailed(final String msg, final Logger log) {
return res -> {
if (res.failed()) {
if (msg != null) {
log.error(msg, res.cause());
} else {
log.error(res.cause());
}
}
};
}
示例9: getLogger
import io.vertx.core.logging.Logger; //导入依赖的package包/类
protected Logger getLogger() {
return LoggerFactory.getLogger(getClass());
}
示例10: jvm
import io.vertx.core.logging.Logger; //导入依赖的package包/类
public static void jvm(final Logger logger, final Throwable ex) {
Fn.safeNull(logger::warn, ex);
ex.printStackTrace();
}
示例11: zero
import io.vertx.core.logging.Logger; //导入依赖的package包/类
public static void zero(final Logger logger, final ZeroException ex) {
Fn.safeNull(logger::warn, ex);
}
示例12: vertx
import io.vertx.core.logging.Logger; //导入依赖的package包/类
public static void vertx(final Logger logger, final VertxException ex) {
Fn.safeNull(logger::warn, ex);
}
示例13: info
import io.vertx.core.logging.Logger; //导入依赖的package包/类
public static void info(final Logger logger, final String pattern, final Object... rest) {
log(logger::isInfoEnabled, logger::info, pattern, rest);
}
示例14: debug
import io.vertx.core.logging.Logger; //导入依赖的package包/类
public static void debug(final Logger logger, final String pattern, final Object... rest) {
log(() -> true, logger::debug, pattern, rest);
}
示例15: warn
import io.vertx.core.logging.Logger; //导入依赖的package包/类
public static void warn(final Logger logger, final String pattern, final Object... rest) {
log(() -> true, logger::warn, pattern, rest);
}