Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.tony19:loggly-client:loggly-client-1.0.3'
}
dependencies {
implementation("com.github.tony19:loggly-client:loggly-client-1.0.3")
}
<dependency>
<groupId>com.github.tony19</groupId>
<artifactId>loggly-client</artifactId>
<version>loggly-client-1.0.3</version>
</dependency>
libraryDependencies += "com.github.tony19" % "loggly-client" % "loggly-client-1.0.3"
:dependencies [[com.github.tony19/loggly-client "loggly-client-1.0.3"]]
A Java library for posting log messages to Loggly, using Retrofit to interface with Loggly's REST API.
Create a LogglyClient
instance with your authorization token from Loggly.
final String LOGGLY_TOKEN = /* your token */;
final ILogglyClient loggly = new LogglyClient(LOGGLY_TOKEN);
Log an event...
loggly.log("Hello world!");
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);
}
});
compile 'com.github.tony19:loggly-client:1.0.3'
<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.