<commit_before>'use strict';

var fs = require('fs'),
    morgan = require('morgan'),
    bunyan = require('bunyan'),
    stream = require('stream').PassThrough,
    bunyanMiddleware = require('express-bunyan-logger'),
    bsyslog = require('bunyan-syslog'),
    msyslog = require('modern-syslog'),
    log,
    loggers = {
        access: function (config) {
            var msyslogStrm = new msyslog.Stream(),
                conf = { format: (config && config.format) || 'combined', opts: { stream: new stream() } };

            conf.opts.stream.pipe(process.stdout);
            if (config && config.file) {
                conf.opts.stream.pipe(fs.createWriteStream(config.file, { flags: 'a' }));
            }
            conf.opts.stream.pipe(msyslogStrm);
            return morgan(conf.format, conf.opts);
        },
        error: function (config) {
            var opts = {
                    name: config && config.name || 'myApp',
                    streams: [
                        {
                            level: 'error',
                            stream: process.stderr
                        }, {
                            level: 'error',
                            type: 'raw',
                            stream: bsyslog.createBunyanStream({
                                type: 'sys',
                                facility: bsyslog.local0,
                                host: '127.0.0.1',
                                port: 514
                            })<commit_msg>Add modern syslog log level and facility to default access logging<commit_after>'use strict';

var fs = require('fs'),
    morgan = require('morgan'),
    bunyan = require('bunyan'),
    stream = require('stream').PassThrough,
    bunyanMiddleware = require('express-bunyan-logger'),
    bsyslog = require('bunyan-syslog'),
    msyslog = require('modern-syslog'),
    log,
    loggers = {
        access: function (config) {
            var msyslogStrm = new msyslog.Stream('LOG_INFO', 'LOG_LOCAL1'),
                conf = { format: (config && config.format) || 'combined', opts: { stream: new stream() } };

            conf.opts.stream.pipe(process.stdout);
            if (config && config.file) {
                conf.opts.stream.pipe(fs.createWriteStream(config.file, { flags: 'a' }));
            }
            conf.opts.stream.pipe(msyslogStrm);
            return morgan(conf.format, conf.opts);
        },
        error: function (config) {
            var opts = {
                    name: config && config.name || 'myApp',
                    streams: [
                        {
                            level: 'error',
                            stream: process.stderr
                        }, {
                            level: 'error',
                            type: 'raw',
                            stream: bsyslog.createBunyanStream({
                                type: 'sys',
                                facility: bsyslog.local0,
                                host: '127.0.0.1',
                                port: 514
                            })
{'fraction_non_alphanumeric': 0.12126085558057254, 'fraction_numerical': 0.006754583467352846, 'mean_word_length': 1.2214285714285715, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '6210690', 'n_tokens_mistral': 822, 'n_tokens_neox': 793, 'n_words': 159}