123456789101112131415161718192021222324252627282930 |
- 'use strict';
- const fecha = require('fecha');
- const format = require('./format');
- module.exports = format((info, opts) => {
- if (opts.format) {
- info.timestamp = typeof opts.format === 'function'
- ? opts.format()
- : fecha.format(new Date(), opts.format);
- }
- if (!info.timestamp) {
- info.timestamp = new Date().toISOString();
- }
- if (opts.alias) {
- info[opts.alias] = info.timestamp;
- }
- return info;
- });
|