<commit_before>/**
 * Copyright 2016 F5 Networks, Inc.
 *
 * 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.
 */
 'use strict';

 var winston = require('winston');

/**
 * @module
 */
module.exports = {
    /**
     * Returns a logger.
     *
     * @param {Object}  [options]          - Options for configuring the logger
     * @param {Boolean} [options.console] - Whether or not to log to the console. Default true.
     * @param {String}  [options.logLevel] - The log level to use. (error, warn, info, verbose, debug, silly). Defaults to warn.
     * @param {String}  [options.fileName] - File to log to. Defaults to none (console only).
     * @param {Object}  [options.module]   - The module the logger is used from. Used to put the file name in the log message.
     *
     * @returns An instance of a logger
     */
    getLogger: function(options) {
        options = options || {};
        if (typeof options.console === 'undefined') {
            options.console = true;
        }

        var transportOptions = {
            level: options.logLevel || 'warn',
            timestamp: function() {
                return new Date().toISOString();
            },
            json: false,
            handleExceptions: false,
            humanReadableUnhandledException: true,
            label: getLabel(options),
            formatter: function(options) {
                if (options.meta) {
                    var keys = Object.keys(options.meta);
                    keys.forEach(function(key) {
                        if (key.toLowerCase() === 'password' || key.toLowerCase() === 'passphrase') {
                            options.meta[key] = '********';<commit_msg>Mask passwords when using set-root-password<commit_after>/**
 * Copyright 2016 F5 Networks, Inc.
 *
 * 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.
 */
 'use strict';

 var winston = require('winston');

/**
 * @module
 */
module.exports = {
    /**
     * Returns a logger.
     *
     * @param {Object}  [options]          - Options for configuring the logger
     * @param {Boolean} [options.console] - Whether or not to log to the console. Default true.
     * @param {String}  [options.logLevel] - The log level to use. (error, warn, info, verbose, debug, silly). Defaults to warn.
     * @param {String}  [options.fileName] - File to log to. Defaults to none (console only).
     * @param {Object}  [options.module]   - The module the logger is used from. Used to put the file name in the log message.
     *
     * @returns An instance of a logger
     */
    getLogger: function(options) {
        options = options || {};
        if (typeof options.console === 'undefined') {
            options.console = true;
        }

        var transportOptions = {
            level: options.logLevel || 'warn',
            timestamp: function() {
                return new Date().toISOString();
            },
            json: false,
            handleExceptions: false,
            humanReadableUnhandledException: true,
            label: getLabel(options),
            formatter: function(options) {
                if (options.meta) {
                    var keys = Object.keys(options.meta);
                    var maskRegex = new RegExp('pass(word|phrase)', 'i');
                    keys.forEach(function(key) {
                        if (maskRegex.test(key)) {
                            options.meta[key] = '********';
{'fraction_non_alphanumeric': 0.10955500338829907, 'fraction_numerical': 0.0040659588886379034, 'mean_word_length': 2.1856115107913667, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2521899', 'n_tokens_mistral': 1157, 'n_tokens_neox': 1128, 'n_words': 430}