Java Code Examples for com.jcabi.log.Logger#info()

The following examples show how to use com.jcabi.log.Logger#info() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Dynamo.java    From jare with MIT License 6 votes vote down vote up
/**
 * 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;
}
 
Example 2
Source File: CompileMojo.java    From eo with MIT License 6 votes vote down vote up
/**
 * 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);
}
 
Example 3
Source File: Logs.java    From jare with MIT License 5 votes vote down vote up
@Override
public void run() {
    try {
        final Iterator<String> ockets = this.bucket.list("").iterator();
        if (ockets.hasNext()) {
            final String name = ockets.next();
            final long bytes = this.process(name);
            this.bucket.remove(name);
            Logger.info(this, "ocket %s processed: %d bytes", name, bytes);
        }
    } catch (final IOException ex) {
        throw new IllegalStateException(ex);
    }
}
 
Example 4
Source File: CompileMojo.java    From eo with MIT License 5 votes vote down vote up
@Override
public void execute() throws MojoFailureException {
    StaticLoggerBinder.getSingleton().setMavenLog(this.getLog());
    if (this.targetDirectory.mkdirs()) {
        Logger.info(this, "Directory created: %s", this.targetDirectory);
    }
    try {
        Files.walk(this.sourceDirectory.toPath())
            .filter(file -> !file.toFile().isDirectory())
            .forEach(this::compile);
    } catch (final IOException ex) {
        throw new MojoFailureException(
            new UncheckedText(
                new FormattedText(
                    "Can't list EO files in %s",
                    this.sourceDirectory
                )
            ).asString(),
            ex
        );
    }
    this.project.addCompileSourceRoot(
        this.targetDirectory.getAbsolutePath()
    );
    Logger.info(
        this, "Directory added to sources: %s",
        this.targetDirectory
    );
}
 
Example 5
Source File: Results.java    From jpeek with MIT License 4 votes vote down vote up
/**
 * Add result.
 * @param artifact The artifact, like "org.jpeek:jpeek"
 * @param dir Directory with files
 * @throws IOException If fails
 */
public void add(final String artifact, final Path dir)
    throws IOException {
    final XML index = new XMLDocument(
        dir.resolve("index.xml").toFile()
    );
    final int elements = Integer.parseInt(
        index.xpath("max(/index/metric/elements/number(text()))").get(0)
    );
    final Number diff = new DyNum(index.xpath("/index/@diff").get(0));
    final long score = new DyNum(
        index.xpath("/index/@score").get(0)
    ).longValue();
    final long rank = (long) ((double) score * (1.0d - diff.doubleValue()));
    // @checkstyle MagicNumber (1 line)
    if (elements < 100) {
        Logger.info(
            this, "%d elements NOT saved for %s by %s, rank=%d, score=%d, metrics=%d",
            elements, artifact, new Version().value(), rank, score,
            Integer.parseInt(index.xpath("count(/index/metric)").get(0))
        );
    } else {
        this.table.put(
            new Attributes()
                .with("good", "true")
                .with("artifact", artifact)
                .with("rank", rank)
                .with("score", score)
                .with("diff", diff.longValue())
                .with(
                    "defects",
                    new DyNum(
                        index.xpath("/index/@defects").get(0)
                    ).longValue()
                )
                .with("elements", elements)
                .with(
                    "classes",
                    Integer.parseInt(
                        index.xpath(
                            "/index/metric[1]/classes/text()"
                        ).get(0)
                    )
                )
                .with("version", new Version().value())
                .with("added", System.currentTimeMillis())
                .with(
                    "ttl",
                    System.currentTimeMillis()
                        / TimeUnit.SECONDS.toMillis(1L)
                        // @checkstyle MagicNumber (1 line)
                        + TimeUnit.DAYS.toSeconds(100L)
                )
        );
        Logger.info(
            this, "%d elements saved for %s by %s, rank=%d, score=%d",
            elements, artifact, new Version().value(), rank, score
        );
    }
}
 
Example 6
Source File: FkUsage.java    From jare with MIT License 4 votes vote down vote up
@Override
public void add(final Date date, final long bytes) {
    Logger.info(this, "usage, date=%s, bytes=%d", date, bytes);
}