<commit_before>'use strict';
const Hoek = require('hoek');
const MongoModels = require('mongo-models');


const register = async function (server, options) {

    Hoek.assert(options.models, 'options.models is required');
    Hoek.assert(options.mongodb, 'options.mongodb is required');
    Hoek.assert(options.mongodb.connection, 'options.mongodb.connection is required');
    Hoek.assert(options.mongodb.connection.uri, 'options.mongodb.connection.uri is required');
    Hoek.assert(options.mongodb.connection.db, 'options.mongodb.connection.db is required');

    const modelModules = options.models.reduce((accumulator, path) => {

        accumulator[path] = require(path);

        return accumulator;
    }, {});

    server.expose('mongo-models', MongoModels);

    server.ext({
        type: 'onPreStart',
        method: async function (_server) {

            if (options.hasOwnProperty('autoIndex') && options.autoIndex === false) {
                return;
            }

            const indexJobs = options.models
                .map((path) => modelModules[path])
                .filter((model) => Boolean(model.indexes))
                .map((model) => model.createIndexes.bind(model, model.indexes));

            await Promise.all(indexJobs);

            server.log(`HapiMongoModels: finished processing auto indexes.`);
        }
    });

    await MongoModels.connect(options.mongodb.connection, options.mongodb.options);

    server.log('HapiMongoModels: successfully connected to the db.');
};


module.exports = {
    name: 'hapi-mongo-models',
    pkg: require('./package.json'),
    register
};
<commit_msg>fix calls to server.log<commit_after>'use strict';
const Hoek = require('hoek');
const MongoModels = require('mongo-models');


const register = async function (server, options) {

    Hoek.assert(options.models, 'options.models is required');
    Hoek.assert(options.mongodb, 'options.mongodb is required');
    Hoek.assert(options.mongodb.connection, 'options.mongodb.connection is required');
    Hoek.assert(options.mongodb.connection.uri, 'options.mongodb.connection.uri is required');
    Hoek.assert(options.mongodb.connection.db, 'options.mongodb.connection.db is required');

    const modelModules = options.models.reduce((accumulator, path) => {

        accumulator[path] = require(path);

        return accumulator;
    }, {});

    server.expose('mongo-models', MongoModels);

    server.ext({
        type: 'onPreStart',
        method: async function (_server) {

            if (options.hasOwnProperty('autoIndex') && options.autoIndex === false) {
                return;
            }

            const indexJobs = options.models
                .map((path) => modelModules[path])
                .filter((model) => Boolean(model.indexes))
                .map((model) => model.createIndexes.bind(model, model.indexes));

            await Promise.all(indexJobs);

            server.log(['info', 'mongodb'], 'HapiMongoModels: finished processing auto indexes.');
        }
    });

    await MongoModels.connect(options.mongodb.connection, options.mongodb.options);

    server.log(['info', 'mongodb'], 'HapiMongoModels: successfully connected to the db.');
};


module.exports = {
    name: 'hapi-mongo-models',
    pkg: require('./package.json'),
    register
};

{'fraction_non_alphanumeric': 0.14178205900060203, 'fraction_numerical': 0.0, 'mean_word_length': 3.0084439083232812, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '429523', 'n_tokens_mistral': 985, 'n_tokens_neox': 928, 'n_words': 183}