<commit_before>/*
 * Copyright 2016 <NAME>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.elvishew.xlogsample;

import android.app.Application;
import android.os.Environment;

import com.elvishew.xlog.LogConfiguration;
import com.elvishew.xlog.LogLevel;
import com.elvishew.xlog.XLog;
import com.elvishew.xlog.printer.AndroidPrinter;
import com.elvishew.xlog.printer.Printer;
import com.elvishew.xlog.printer.file.FilePrinter;
import com.elvishew.xlog.printer.file.naming.DateFileNameGenerator;

import java.io.File;

public class XLogSampleApplication extends Application {

  public static Printer globalFilePrinter;

  @Override
  public void onCreate() {
    super.onCreate();

    initXlog();
  }

  /**
   * Initialize XLog.
   */
  private void initXlog() {
    LogConfiguration config = new LogConfiguration.Builder()
        .tag(getString(R.string.global_tag))                   // Specify TAG, default: "X-LOG"
        // .t()                                                // Enable thread info, disabled by default
        // .st(2)                                              // Enable stack trace info with depth 2, disabled by default
        // .b()                                                // Enable border, disabled by default
        // .jsonFormatter(new MyJsonFormatter())               // Default: DefaultJsonFormatter
        // .xmlFormatter(new MyXmlFormatter())                 // Default: DefaultXmlFormatter
        // .throwableFormatter(new MyThrowableFormatter())     // Default: DefaultThrowableFormatter
        // .threadFormatter(new MyThreadFormatter())           // Default: DefaultThreadFormatter
        // .stackTraceFormatter(new MyStackTraceFormatter())   // Default: DefaultStackTraceFormatter
        // .borderFormatter(new MyBoardFormatter())            // Default: DefaultBorderFormatter
        // .addObjectFormatter(AnyClass.class,                 // Add formatter for specific class of object
        //     new AnyClassObjectFormatter())                  // Use Object.toString() by default
        .build();

    Printer androidPrinter = new AndroidPrinter();             // Printer that print the log using android.util.Log
    Printer filePrinter = new FilePrinter                      // Printer that print the log to the file system
        .Builder(new File(Environment.getExternalStorageDirectory(), "xlogsample").getPath())       // Specify the path to save log file
        .fileNameGenerator(new DateFileNameGenerator())        // Default: ChangelessFileNameGenerator("log")
        // .backupStrategy(new MyBackupStrategy())             // Default: FileSizeBackupStrategy(1024 * 1024)
        // .logFlattener(new MyLogFlattener())                 // Default: DefaultLogFlattener
        .build();

    XLog.init(BuildConfig.DEBUG ? LogLevel.ALL : LogLevel.NONE,// Specify the log level, logs below this level won't be printed
        config,                                                // Specify the log configuration, if not specified, will use new LogConfiguration.Builder().build()
        androidPrinter,                                        // Specify printers, if no printer is specified, AndroidPrinter will be used by default
        filePrinter);

    // For future usage: partial usage in MainActivity.
    globalFilePrinter = filePrinter;
  }
}<commit_msg>Update initialization codes in sample<commit_after>/*
 * Copyright 2016 <NAME>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.elvishew.xlogsample;

import android.app.Application;
import android.os.Environment;

import com.elvishew.xlog.LogConfiguration;
import com.elvishew.xlog.LogLevel;
import com.elvishew.xlog.XLog;
import com.elvishew.xlog.flattener.ClassicFlattener;
import com.elvishew.xlog.interceptor.BlacklistTagsFilterInterceptor;
import com.elvishew.xlog.printer.AndroidPrinter;
import com.elvishew.xlog.printer.Printer;
import com.elvishew.xlog.printer.file.FilePrinter;
import com.elvishew.xlog.printer.file.naming.DateFileNameGenerator;

import java.io.File;

public class XLogSampleApplication extends Application {

  public static Printer globalFilePrinter;

  @Override
  public void onCreate() {
    super.onCreate();

    initXlog();
  }

  /**
   * Initialize XLog.
   */
  private void initXlog() {
    LogConfiguration config = new LogConfiguration.Builder()
        .logLevel(BuildConfig.DEBUG ? LogLevel.ALL             // Specify log level, logs below this level won't be printed, default: LogLevel.ALL
            : LogLevel.NONE)
        .tag(getString(R.string.global_tag))                   // Specify TAG, default: "X-LOG"
        // .t()                                                // Enable thread info, disabled by default
        // .st(2)                                              // Enable stack trace info with depth 2, disabled by default
        // .b()                                                // Enable border, disabled by default
        // .jsonFormatter(new MyJsonFormatter())               // Default: DefaultJsonFormatter
        // .xmlFormatter(new MyXmlFormatter())                 // Default: DefaultXmlFormatter
        // .throwableFormatter(new MyThrowableFormatter())     // Default: DefaultThrowableFormatter
        // .threadFormatter(new MyThreadFormatter())           // Default: DefaultThreadFormatter
        // .stackTraceFormatter(new MyStackTraceFormatter())   // Default: DefaultStackTraceFormatter
        // .borderFormatter(new MyBoardFormatter())            // Default: DefaultBorderFormatter
        // .addObjectFormatter(AnyClass.class,                 // Add formatter for specific class of object
        //     new AnyClassObjectFormatter())                  // Use Object.toString() by default
        .addInterceptor(new BlacklistTagsFilterInterceptor(    // Add blacklist tags filter
            "blacklist1", "blacklist2", "blacklist3"))
        // .addInterceptor(new WhitelistTagsFilterInterceptor( // Add whitelist tags filter
        //     "whitelist1", "whitelist2", "whitelist3"))
        // .addInterceptor(new MyInterceptor())                // Add a log interceptor
        .build();

    Printer androidPrinter = new AndroidPrinter();             // Printer that print the log using android.util.Log
    Printer filePrinter = new FilePrinter                      // Printer that print the log to the file system
        .Builder(new File(Environment.getExternalStorageDirectory(), "xlogsample").getPath())       // Specify the path to save log file
        .fileNameGenerator(new DateFileNameGenerator())        // Default: ChangelessFileNameGenerator("log")
        // .backupStrategy(new MyBackupStrategy())             // Default: FileSizeBackupStrategy(1024 * 1024)
        .logFlattener(new ClassicFlattener())                  // Default: DefaultFlattener
        .build();

    XLog.init(                                                 // Initialize XLog
        config,                                                // Specify the log configuration, if not specified, will use new LogConfiguration.Builder().build()
        androidPrinter,                                        // Specify printers, if no printer is specified, AndroidPrinter(for Android)/ConsolePrinter(for java) will be used.
        filePrinter);

    // For future usage: partial usage in MainActivity.
    globalFilePrinter = filePrinter;
  }
}
{'fraction_non_alphanumeric': 0.0894212523719165, 'fraction_numerical': 0.004981024667931689, 'mean_word_length': 2.2813229571984435, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 22, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6001556', 'n_tokens_mistral': 2066, 'n_tokens_neox': 2010, 'n_words': 624}