<commit_before>//
// Copyright (c) 2012 Sebnarware. All rights reserved.
//

//
// required packages
//
var winston = require('winston');
var express = require('express');
var gzippo = require('gzippo');
var fs = require('fs');
var forecasts = require('./forecasts.js');


runServer();

function runServer() {

    configLogger();

    initializeForecastProcessing();

    startHTTPServer();
}

function configLogger() {
    // remove the default transport, so that we can reconfigure it
    winston.remove(winston.transports.Console);

    // verbose, info, warn, error are the log levels we're using
    winston.add(winston.transports.Console, {level:'info', handleExceptions:true});

    if (process.env.DEBUG) {
        winston.info('development mode, NOT logging to Loggly');
    } else {
        winston.info('production mode, logging to Loggly');
        winston.add(winston.transports.Loggly, {level:'info', handleExceptions:true, subdomain:'aviforecast', inputToken:'<PASSWORD>'});
    }
}

function initializeForecastProcessing() {

    var regions = JSON.parse(fs.readFileSync(forecasts.REGIONS_PATH, 'utf8'));

    // generate the forecast content
    forecasts.aggregateForecasts(regions);

    // configure a timer to regenerate the forecast content on a recurring basis
    setInterval(forecasts.aggregateForecasts, forecasts.FORECAST_GEN_INTERVAL_SECONDS * 1000, regions);
}

function startHTTPServer() {

    var app = express.createServer();

    // set up the express middleware, in the order we want it to execute

    // enable web server logging; pipe those log messages through winston
    var winstonStream = {
        write: function(str){
            winston.info(str);
        }
    };<commit_msg>switch loggly subdomain, based on their request<commit_after>//
// Copyright (c) 2012 Sebnarware. All rights reserved.
//

//
// required packages
//
var winston = require('winston');
var express = require('express');
var gzippo = require('gzippo');
var fs = require('fs');
var forecasts = require('./forecasts.js');


runServer();

function runServer() {

    configLogger();

    initializeForecastProcessing();

    startHTTPServer();
}

function configLogger() {
    // remove the default transport, so that we can reconfigure it
    winston.remove(winston.transports.Console);

    // verbose, info, warn, error are the log levels we're using
    winston.add(winston.transports.Console, {level:'info', handleExceptions:true});

    if (process.env.DEBUG) {
        winston.info('development mode, NOT logging to Loggly');
    } else {
        winston.info('production mode, logging to Loggly');
        winston.add(winston.transports.Loggly, {level:'info', handleExceptions:true, subdomain:'logs', inputToken:'<PASSWORD>'});
    }
}

function initializeForecastProcessing() {

    var regions = JSON.parse(fs.readFileSync(forecasts.REGIONS_PATH, 'utf8'));

    // generate the forecast content
    forecasts.aggregateForecasts(regions);

    // configure a timer to regenerate the forecast content on a recurring basis
    setInterval(forecasts.aggregateForecasts, forecasts.FORECAST_GEN_INTERVAL_SECONDS * 1000, regions);
}

function startHTTPServer() {

    var app = express.createServer();

    // set up the express middleware, in the order we want it to execute

    // enable web server logging; pipe those log messages through winston
    var winstonStream = {
        write: function(str){
            winston.info(str);
        }
    };
{'fraction_non_alphanumeric': 0.11884892086330935, 'fraction_numerical': 0.005179856115107914, 'mean_word_length': 3.665771812080537, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1926503', 'n_tokens_mistral': 1039, 'n_tokens_neox': 968, 'n_words': 278}