本文整理汇总了Java中com.jcabi.log.Logger.info方法的典型用法代码示例。如果您正苦于以下问题:Java Logger.info方法的具体用法?Java Logger.info怎么用?Java Logger.info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jcabi.log.Logger
的用法示例。
在下文中一共展示了Logger.info方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUserSubcriptionCheck
import com.jcabi.log.Logger; //导入方法依赖的package包/类
/**
* Endpoint: Check User Subscription by Channel
* Checks if a specified user is subscribed to a specified channel.
* Requires Scope: user_subscriptions
*
* @param userId UserId of the user.
* @param channelId ChannelId of the channel you are checking against.
* @return Optional of Type UserSubscriptionCheck. Is only present, when the user is subscribed.
*/
public Optional<UserSubscriptionCheck> getUserSubcriptionCheck(Long userId, Long channelId) {
// Endpoint
String requestUrl = String.format("%s/users/%s/subscriptions/%s", Endpoints.API.getURL(), userId, channelId);
RestTemplate restTemplate = getTwitchClient().getRestClient().getRestTemplate();
// REST Request
try {
Logger.trace(this, "Rest Request to [%s]", requestUrl);
UserSubscriptionCheck responseObject = restTemplate.getForObject(requestUrl, UserSubscriptionCheck.class);
return Optional.ofNullable(responseObject);
} catch (RestException restException) {
if (restException.getRestError().getStatus().equals(422)) {
// Channel has no subscription program.
Logger.info(this, "Channel %s has no subscription programm.", channelId);
} else {
Logger.error(this, "RestException: " + restException.getRestError().toString());
}
} catch (Exception ex) {
Logger.error(this, "Request failed: " + ex.getMessage());
Logger.trace(this, ExceptionUtils.getStackTrace(ex));
}
return Optional.empty();
}
示例2: connect
import com.jcabi.log.Logger; //导入方法依赖的package包/类
/**
* Connect.
* @return Region
*/
private static Region connect() {
final String key = Manifests.read("Rehttp-DynamoKey");
final Credentials creds = new Credentials.Simple(
key, Manifests.read("Rehttp-DynamoSecret")
);
final Region region;
if (key.startsWith("AAAAA")) {
final int port = Integer.parseInt(
System.getProperty("dynamo.port")
);
region = new Region.Simple(new Credentials.Direct(creds, port));
Logger.warn(Entrance.class, "Test DynamoDB at port #%d", port);
} else {
region = new Region.Prefixed(
new ReRegion(new Region.Simple(creds)),
"rehttp-"
);
}
Logger.info(Entrance.class, "DynamoDB connected as %s", key);
return region;
}
示例3: connect
import com.jcabi.log.Logger; //导入方法依赖的package包/类
/**
* Connect.
* @return Region
*/
private static Region connect() {
final String key = Manifests.read("ThreeCopies-DynamoKey");
final Credentials creds = new Credentials.Simple(
key, Manifests.read("ThreeCopies-DynamoSecret")
);
final Region region;
if (key.startsWith("AAAAA")) {
final int port = Integer.parseInt(
System.getProperty("dynamo.port")
);
region = new Region.Simple(new Credentials.Direct(creds, port));
Logger.warn(Dynamo.class, "Test DynamoDB at port #%d", port);
} else {
region = new Region.Prefixed(
new ReRegion(new Region.Simple(creds)),
"tc-"
);
}
Logger.info(Dynamo.class, "DynamoDB connected as %s", key);
return region;
}
示例4: apply
import com.jcabi.log.Logger; //导入方法依赖的package包/类
@Override
public Integer apply(final Void none) throws Exception {
int scripts = 0;
int items = 0;
for (final Script script : this.base.scripts()) {
for (final Item item : script.open()) {
if (item.has("container")) {
this.kill(item);
this.finish(script, item);
} else {
this.start(script, item);
}
++items;
}
++scripts;
}
Logger.info(this, "%d log items seen in %d scripts", items, scripts);
return items;
}
示例5: connect
import com.jcabi.log.Logger; //导入方法依赖的package包/类
/**
* Connect.
* @return Region
*/
private static Region connect() {
final String key = Manifests.read("Jare-DynamoKey");
final Credentials creds = new Credentials.Simple(
key, Manifests.read("Jare-DynamoSecret")
);
final Region region;
if (key.startsWith("AAAAA")) {
final int port = Integer.parseInt(
System.getProperty("dynamo.port")
);
region = new Region.Simple(new Credentials.Direct(creds, port));
Logger.warn(Dynamo.class, "test DynamoDB at port #%d", port);
} else {
region = new Region.Prefixed(
new ReRegion(new Region.Simple(creds)),
"jare-"
);
}
Logger.info(Dynamo.class, "DynamoDB connected as %s", key);
return region;
}
示例6: add
import com.jcabi.log.Logger; //导入方法依赖的package包/类
@Override
public void add(final String json) throws IOException {
Json.createReader(new InputOf(json).stream()).readObject();
final long num = System.currentTimeMillis();
this.table().put(
new Attributes()
.with("urn", this.urn)
.with("id", num)
.with("json", json)
.with("status", String.format("Created at %s", new Date()))
.with("time", System.currentTimeMillis())
);
Logger.info(
this, "new pipe #%d created by %s",
num, this.urn
);
}
示例7: push
import com.jcabi.log.Logger; //导入方法依赖的package包/类
@Override
public void push(final Events events) throws IOException {
final String body = this.text();
final Coordinates coords = this.issue.repo().coordinates();
if (body.isEmpty()) {
Logger.info(
this, "%s#%d ignored",
coords, this.issue.number()
);
} else {
events.post(
String.format(
"[%s#%d] %s",
coords, this.issue.number(), this.issue.title()
),
body
);
Logger.info(
this, "new event in %s#%d",
coords, this.issue.number()
);
}
}
示例8: push
import com.jcabi.log.Logger; //导入方法依赖的package包/类
@Override
public void push(final Events events) throws IOException {
final Coordinates coords = this.commit.repo().coordinates();
final String body = this.text(coords);
if (body.isEmpty()) {
Logger.info(
this, "%s %s ignored",
coords, this.commit.sha()
);
} else {
events.post(
String.format(
"[%s] %s",
coords, this.commit.sha()
),
body
);
Logger.info(
this, "new event in %s#%s",
coords, this.commit.sha()
);
}
}
示例9: compile
import com.jcabi.log.Logger; //导入方法依赖的package包/类
/**
* Compile one EO file.
* @param file EO file
*/
private void compile(final Path file) {
try {
new Program(
new InputOf(file),
this.targetDirectory.toPath()
).compile();
} catch (final IOException ex) {
throw new IllegalStateException(
new UncheckedText(
new FormattedText(
"Can't compile %s into %s",
file, this.targetDirectory
)
).asString(),
ex
);
}
Logger.info(this, "%s compiled to %s", file, this.targetDirectory);
}
示例10: create
import com.jcabi.log.Logger; //导入方法依赖的package包/类
@Override
@NotNull(message = "repo is never NULL")
public Repo create(
@NotNull(message = "settings can't be NULL")
final RepoCreate settings
) throws IOException {
final Coordinates coords = new Coordinates.Simple(
this.self,
settings.name()
);
this.storage.apply(
new Directives().xpath(this.xpath()).add("repo")
.attr("coords", coords.toString())
.add("name").set(settings.name()).up()
.add("description").set("test repository").up()
.add("private").set("false").up()
);
final Repo repo = this.get(coords);
repo.patch(settings.json());
Logger.info(
this, "repository %s created by %s",
coords, this.self
);
return repo;
}
示例11: create
import com.jcabi.log.Logger; //导入方法依赖的package包/类
@Override
@NotNull(message = "created fork is never NULLs")
public Fork create(
@NotNull(message = "org can't be NULL") final String org
) throws IOException {
this.storage.lock();
final int number;
try {
number = 1 + this.storage.xml().xpath(
String.format("%s/fork/id/text()", this.xpath())
).size();
this.storage.apply(
new Directives().xpath(this.xpath()).add("fork")
.add("id").set(Integer.toString(number)).up()
.attr("organization", org)
);
} finally {
this.storage.unlock();
}
Logger.info(
this, "fork %s created inside %s by %s",
this.coords, org, this.self
);
return this.get(number);
}
示例12: send
import com.jcabi.log.Logger; //导入方法依赖的package包/类
@Override
public void send(final Envelope env) throws IOException {
final Message message = new Envelope.Strict(env).unwrap();
final Transport transport = this.wire.connect();
try {
final Address[] rcpts = message.getAllRecipients();
transport.sendMessage(message, rcpts);
Logger.info(
this, "email sent from %s to %[list]s",
Arrays.asList(message.getFrom()),
Arrays.asList(rcpts)
);
} catch (final MessagingException ex) {
throw new IOException(ex);
} finally {
Postman.Default.close(transport);
}
}
示例13: execute
import com.jcabi.log.Logger; //导入方法依赖的package包/类
@Override
public void execute() throws MojoFailureException {
StaticLoggerBinder.getSingleton().setMavenLog(this.getLog());
if (this.skip) {
Logger.info(this, "execution skipped because of 'skip' option");
} else {
if (SystemUtils.IS_OS_WINDOWS) {
throw new MojoFailureException(
"Sorry, this plugin cannot run on Windows system!"
);
}
if (this.outputDir.mkdirs()) {
Logger.info(this, "directories created for %s", this.outputDir);
}
final Compiler compiler = new Compiler(this.tempDir);
for (final String src : this.sources) {
this.compile(compiler, src);
}
}
}
示例14: compile
import com.jcabi.log.Logger; //导入方法依赖的package包/类
/**
* Compile one source.
* @param compiler The compiler to use
* @param name The name of the source
* @throws MojoFailureException If some problem
*/
private void compile(final Compiler compiler, final String name)
throws MojoFailureException {
final long start = System.nanoTime();
try {
final Source source = new Source(
this.sourcesDir,
name,
this.closures
);
final Output output = compiler.compile(source);
output.saveTo(this.outputDir);
Logger.info(
this,
"'%s' compiled and saved as '%s', in %[nano]s",
source,
output,
System.nanoTime() - start
);
} catch (final IOException ex) {
throw new MojoFailureException(
String.format("Failed to compile '%s'", name),
ex
);
}
}
示例15: start
import com.jcabi.log.Logger; //导入方法依赖的package包/类
@Override
public MkContainer start(final int prt) throws IOException {
if (this.port != 0) {
throw new IllegalStateException(
String.format(
"already listening on port %d, use #stop() first",
this.port
)
);
}
this.port = prt;
this.gws = new GrizzlyWebServer(this.port);
this.gws.addGrizzlyAdapter(this.adapter, new String[] {"/"});
this.gws.start();
Logger.info(this, "started on port #%s", prt);
return this;
}