This file is indexed.

/usr/lib/nodejs/log4js/appenders/dateFile.js is in node-log4js 0.6.9-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
"use strict";
var streams = require('../streams')
, layouts = require('../layouts')
, path = require('path')
, os = require('os')
, eol = os.EOL || '\n'
, openFiles = [];

//close open files on process exit.
process.on('exit', function() {
  openFiles.forEach(function (file) {
    file.end();
  });
});

/**
 * File appender that rolls files according to a date pattern.
 * @filename base filename.
 * @pattern the format that will be added to the end of filename when rolling,
 *          also used to check when to roll files - defaults to '.yyyy-MM-dd'
 * @layout layout function for log messages - defaults to basicLayout
 */
function appender(filename, pattern, alwaysIncludePattern, layout) {
  layout = layout || layouts.basicLayout;

  var logFile = new streams.DateRollingFileStream(
    filename, 
    pattern, 
    { alwaysIncludePattern: alwaysIncludePattern }
  );
  openFiles.push(logFile);
  
  return function(logEvent) {
    logFile.write(layout(logEvent) + eol, "utf8");
  };

}

function configure(config, options) {
  var layout;
  
  if (config.layout) {
    layout = layouts.layout(config.layout.type, config.layout);
  }
  
  if (!config.alwaysIncludePattern) {
    config.alwaysIncludePattern = false;
  }
  
  if (options && options.cwd && !config.absolute) {
    config.filename = path.join(options.cwd, config.filename);
  }

  return appender(config.filename, config.pattern, config.alwaysIncludePattern, layout);
}

exports.appender = appender;
exports.configure = configure;