<commit_before>'use strict'

var redis = require('redis');
var async = require('async');
var log4js = require('log4js');

const alltime = 'alltime';
const daily = 'daily';
const weekly = 'weekly';
const monthly = 'monthly';

const field_scoreId = 'score_id';
const field_userId = 'user_id';
const field_featureId = 'feature_id';
const field_date = 'date';
const field_score = 'score'
const field_scoreData = 'score_data';

const field_best_score = 'best_score';

const key_score = 'score:'
const key_userId = field_userId + ':'
const key_featureAllTimeBestScoreId =  'featureAllTimeBestScore:' // key for sorted set for all time best scores
const key_userFeatureAllTimeBestScoreId = 'userFeatureAllTimeBestScore:' // key for hashes for user's best for a feature
const key_featureDailyBestScoreId =  'featureDailyBestScore:' // key for sorted set for daily best scores
const key_userFeatureDailyBestScoreId = 'userFeatureDailyBestScore:'
const key_featureWeeklyBestScoreId =  'featureWeeklyBestScore:' // key for sorted set for weekly best scores
const key_userFeatureWeeklyBestScoreId = 'userFeatureWeeklyBestScore:'
const key_featureMonthlyBestScoreId =  'featureMonthlyBestScore:' // key for sorted set for monthly best scores
const key_userFeatureMonthlyBestScoreId = 'userFeatureMonthlyBestScore:'

/**
 * Constructor
 */
function RedisEndpoint (){}

RedisEndpoint.prototype.addPeriodicalLeaderboard = function (period) {
  if (period === 'daily') {
    this.dailyBoard = true;
  } else if  (period === 'weekly') {
    this.weeklyBoard = true;
  } else if  (period === 'monthly') {
    this.monthlyBoard = true;
  }
}

/**
 * Creates a new Redis client
 */
RedisEndpoint.prototype.createClient = function (port_arg, host_arg, options) {
  this.logger = log4js.getLogger();
  this.logger.setLevel('DEBUG');

  this.client = redis.createClient(port_arg, host_arg, options);
  this.logger.debug('Created a client');
  // Executed if errors happen
  this.client.on('error', (err) => {
      this.logger.error('error event - ' + this.client.host + ':' + this.client.port + ' - ' + err);
  });<commit_msg>Changed log level to ERROR<commit_after>'use strict'

var redis = require('redis');
var async = require('async');
var log4js = require('log4js');

const alltime = 'alltime';
const daily = 'daily';
const weekly = 'weekly';
const monthly = 'monthly';

const field_scoreId = 'score_id';
const field_userId = 'user_id';
const field_featureId = 'feature_id';
const field_date = 'date';
const field_score = 'score'
const field_scoreData = 'score_data';

const field_best_score = 'best_score';

const key_score = 'score:'
const key_userId = field_userId + ':'
const key_featureAllTimeBestScoreId =  'featureAllTimeBestScore:' // key for sorted set for all time best scores
const key_userFeatureAllTimeBestScoreId = 'userFeatureAllTimeBestScore:' // key for hashes for user's best for a feature
const key_featureDailyBestScoreId =  'featureDailyBestScore:' // key for sorted set for daily best scores
const key_userFeatureDailyBestScoreId = 'userFeatureDailyBestScore:'
const key_featureWeeklyBestScoreId =  'featureWeeklyBestScore:' // key for sorted set for weekly best scores
const key_userFeatureWeeklyBestScoreId = 'userFeatureWeeklyBestScore:'
const key_featureMonthlyBestScoreId =  'featureMonthlyBestScore:' // key for sorted set for monthly best scores
const key_userFeatureMonthlyBestScoreId = 'userFeatureMonthlyBestScore:'

/**
 * Constructor
 */
function RedisEndpoint (){}

RedisEndpoint.prototype.addPeriodicalLeaderboard = function (period) {
  if (period === 'daily') {
    this.dailyBoard = true;
  } else if  (period === 'weekly') {
    this.weeklyBoard = true;
  } else if  (period === 'monthly') {
    this.monthlyBoard = true;
  }
}

/**
 * Creates a new Redis client
 */
RedisEndpoint.prototype.createClient = function (port_arg, host_arg, options) {
  this.logger = log4js.getLogger();
  this.logger.setLevel('ERROR');

  this.client = redis.createClient(port_arg, host_arg, options);
  this.logger.debug('Created a client');
  // Executed if errors happen
  this.client.on('error', (err) => {
      this.logger.error('error event - ' + this.client.host + ':' + this.client.port + ' - ' + err);
  });
{'fraction_non_alphanumeric': 0.11945958757999527, 'fraction_numerical': 0.001422137947380896, 'mean_word_length': 5.142649199417758, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4604142', 'n_tokens_mistral': 1303, 'n_tokens_neox': 1292, 'n_words': 344}