loggly-client

A Java REST client for Loggly

License

License

Categories

Categories

CLI User Interface
GroupId

GroupId

com.github.tony19
ArtifactId

ArtifactId

loggly-client
Last Version

Last Version

1.0.3
Release Date

Release Date

Type

Type

jar
Description

Description

loggly-client
A Java REST client for Loggly
Project URL

Project URL

http://github.com/tony19/loggly-client
Source Code Management

Source Code Management

https://github.com/tony19/loggly-client

Download loggly-client

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.tony19/loggly-client/ -->
<dependency>
    <groupId>com.github.tony19</groupId>
    <artifactId>loggly-client</artifactId>
    <version>1.0.3</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.tony19/loggly-client/
implementation 'com.github.tony19:loggly-client:1.0.3'
// https://jarcasting.com/artifacts/com.github.tony19/loggly-client/
implementation ("com.github.tony19:loggly-client:1.0.3")
'com.github.tony19:loggly-client:jar:1.0.3'
<dependency org="com.github.tony19" name="loggly-client" rev="1.0.3">
  <artifact name="loggly-client" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.tony19', module='loggly-client', version='1.0.3')
)
libraryDependencies += "com.github.tony19" % "loggly-client" % "1.0.3"
[com.github.tony19/loggly-client "1.0.3"]

Dependencies

compile (2)

Group / Artifact Type Version
com.jakewharton.timber : timber jar 2.5.1
com.squareup.retrofit : retrofit jar 1.9.0

test (2)

Group / Artifact Type Version
junit : junit jar 4.11
org.mockito : mockito-core jar 1.9.5

Project Modules

There are no modules declared in this project.

loggly-client

v1.0.3

A Java library for posting log messages to Loggly, using Retrofit to interface with Loggly's REST API.

Quickstart

  1. Create a LogglyClient instance with your authorization token from Loggly.
final String LOGGLY_TOKEN = /* your token */;
final ILogglyClient loggly = new LogglyClient(LOGGLY_TOKEN);
  1. Log an event...
loggly.log("Hello world!");

API

setTags(String... tags)

Sets the Loggly tag(s) with variable arity strings (or with a CSV) to be applied to all subsequent log calls. Specify empty string to clear all tags.

loggly.setTags("foo", "bar");
// or equivalently:
loggly.setTags("foo,bar");

log(String message)

Logs a single event

loggly.log("hello world!");

log(String message, Callback callback)

Logs an event asynchronously

loggly.log("hello",
        new LogglyClient.Callback() {
            @Override
            public void success() {
                System.out.println("ok");
            }

            @Override
            public void failure(String error) {
                System.err.println("error: " + error);
            }
        });

logBulk(String... messages)

Note: In order to preserve event boundaries in a bulk upload, loggly-client replaces new-line characters ('\n') with carriage-returns ('\r'), which are subsequently stripped by Loggly.

Logs multiple events in bulk with variable arity strings

loggly.logBulk("event 1", "event 2");

logBulk(Collection<String> messages)

Logs multiple events in bulk with a Collection<String>

Collection<String> events = Arrays.asList("event 1", "event 2");
loggly.logBulk(events);

logBulk(Collection<String> messages, Callback callback)

Logs multiple events asynchronously in bulk with a Collection<String>

Collection<String> events = Arrays.asList("event 1", "event 2");
loggly.logBulk(events,
        new LogglyClient.Callback() {
            @Override
            public void success() {
                System.out.println("ok");
            }

            @Override
            public void failure(String error) {
                System.err.println("error: " + error);
            }
        });

Download

loggly-client-1.0.3.jar

Gradle

compile 'com.github.tony19:loggly-client:1.0.3'

Maven

<dependency>
  <groupId>com.github.tony19</groupId>
  <artifactId>loggly-client</artifactId>
  <version>1.0.3</version>
</dependency>

Snapshots of the development version are available in Sonatype's snapshots repository.

Versions

Version
1.0.3
1.0.2
1.0.1
1.0.0