Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated LogglyClient.java for tag support #1

Closed
wants to merge 7 commits into from
@@ -18,28 +18,31 @@
import java.util.Arrays;
import java.util.Collection;

import android.util.Log;

import retrofit.RestAdapter;
import retrofit.RetrofitError;
import retrofit.client.Response;
import retrofit.mime.TypedString;

/**
* Loggly client
*
*
* @author tony19@gmail.com
*/
public class LogglyClient implements ILogglyClient {
private static final String API_URL = "http://logs-01.loggly.com/";
private final ILogglyRestService loggly;
private final String token;
private String tags;
private ILogglyRestService loggly;
private String token;
private static String tags = "android";

/**
* Creates a Loggly client
* @param token Loggly customer token
* http://loggly.com/docs/customer-token-authentication-token/
* http://loggly.com/docs/customer-token-authentication-token/tag/android
*/
public LogglyClient(String token) {
this(token, tags);
if (token == null || token.isEmpty()) {
throw new IllegalArgumentException("token cannot be empty");
}
@@ -52,6 +55,18 @@ public LogglyClient(String token) {
this.loggly = restAdapter.create(ILogglyRestService.class);
}

public LogglyClient(String token, String tag) {
if (token == null || token.isEmpty()) {
throw new IllegalArgumentException("token cannot be empty");
}

RestAdapter restAdapter = new RestAdapter.Builder()
.setEndpoint(API_URL).build();
this.tags = tag;
this.token = token;
this.loggly = restAdapter.create(ILogglyRestService.class);
}

/**
* Creates a Loggly client with the specified REST API.
* This is package private for internal testing only.
@@ -112,6 +127,7 @@ public boolean log(String message) {
* @param message message to be logged
* @param callback callback to be invoked on completion of the post
*/

public void log(String message, final Callback callback) {
if (message == null) return;

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.