<commit_before>package com.emmaguy.todayilearned;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.util.Log;

import com.google.android.gms.analytics.GoogleAnalytics;
import com.google.android.gms.analytics.HitBuilders;
import com.google.android.gms.analytics.StandardExceptionParser;
import com.google.android.gms.analytics.Tracker;

public class Logger {
    public static final String LOG_EVENT_SYNC_SUBREDDITS = "SyncSubreddits";
    public static final String LOG_EVENT_UPDATE_INTERVAL = "UpdateInterval";
    public static final String LOG_EVENT_SAVE_TO_POCKET = "SaveToPocket";
    public static final String LOG_EVENT_REPLY_TO_POST = "ReplyToPost";
    public static final String LOG_EVENT_SEND_DM = "SendDM";
    public static final String LOG_EVENT_LOGIN = "Login";

    public static final String LOG_EVENT_SUCCESS = "Success";
    public static final String LOG_EVENT_FAILURE = "Failure";

    private static Tracker mTracker;

    public static void Log(String message) {
        if (BuildConfig.DEBUG) {
            Log.d("RedditWear", message);
        }
    }

    private static boolean isConnectedToNetwork(Context context) {
        ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
        return activeNetworkInfo != null && activeNetworkInfo.isConnected();
    }

    public static void sendThrowable(Context c, String message, Throwable t) {
        if (BuildConfig.DEBUG) {
            Log.e("RedditWear", message, t);
        } else {
            String description = new StandardExceptionParser(c, null).getDescription(Thread.currentThread().getName(), t);
            getTracker(c)
                    .send(new HitBuilders.EventBuilder()
                            .setCategory(description)
                            .setAction(message)
                            .setLabel("Connected to network: " + String.valueOf(isConnectedToNetwork(c)))
                            .build());
        }
    }

    public static void sendEvent(Context c, String action, String label) {
        if (BuildConfig.DEBUG) {
            Log("Sending event: " + action + " " + label);
        } else {<commit_msg>added more info to logging<commit_after>package com.emmaguy.todayilearned;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.util.Log;

import com.google.android.gms.analytics.GoogleAnalytics;
import com.google.android.gms.analytics.HitBuilders;
import com.google.android.gms.analytics.StandardExceptionParser;
import com.google.android.gms.analytics.Tracker;

import retrofit.RetrofitError;
import retrofit.client.Response;

public class Logger {
    public static final String LOG_EVENT_SYNC_SUBREDDITS = "SyncSubreddits";
    public static final String LOG_EVENT_UPDATE_INTERVAL = "UpdateInterval";
    public static final String LOG_EVENT_SAVE_TO_POCKET = "SaveToPocket";
    public static final String LOG_EVENT_REPLY_TO_POST = "ReplyToPost";
    public static final String LOG_EVENT_SEND_DM = "SendDM";
    public static final String LOG_EVENT_LOGIN = "Login";

    public static final String LOG_EVENT_SUCCESS = "Success";
    public static final String LOG_EVENT_FAILURE = "Failure";

    private static Tracker mTracker;

    public static void Log(String message) {
        if (BuildConfig.DEBUG) {
            Log.d("RedditWear", message);
        }
    }

    private static boolean isConnectedToNetwork(Context context) {
        ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
        return activeNetworkInfo != null && activeNetworkInfo.isConnected();
    }

    public static void sendThrowable(Context c, String message, Throwable t) {
        if (BuildConfig.DEBUG) {
            Log.e("RedditWear", message, t);
        } else {
            String description = "Exception: " + t.getMessage() + " " + new StandardExceptionParser(c, null).getDescription(Thread.currentThread().getName(), t);

            if (t instanceof RetrofitError) {
                RetrofitError retrofitError = (RetrofitError) t;
                description += " " + retrofitError.getKind();

                Response response = retrofitError.getResponse();
                if (response != null) {
                    description += " " + response.getStatus() + " " + response.getReason();
                }
            }

            getTracker(c)
                    .send(new HitBuilders.EventBuilder()
                            .setCategory(description)
                            .setAction(message)
                            .setLabel("Connected to network: " + String.valueOf(isConnectedToNetwork(c)))
                            .build());
        }
    }

    public static void sendEvent(Context c, String action, String label) {
        if (BuildConfig.DEBUG) {
            Log("Sending event: " + action + " " + label);
        } else {
{'fraction_non_alphanumeric': 0.09000382995021065, 'fraction_numerical': 0.0, 'mean_word_length': 2.889054355919583, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6099848', 'n_tokens_mistral': 1391, 'n_tokens_neox': 1376, 'n_words': 319}