trentm/node-bunyan

Change time zone to local time in createLogger

WayneTvT opened this issue · 0 comments

Current I'm using the following code to create

// setup bunyan logger
const log = Bunyan.createLogger({

	name: 'app',

	streams: [
		{
			stream: process.stdout
		},
		{
			stream: new RotatingFileStream({
				level: 'trace',
				path: logPath,
				period: '1d',          // daily rotation
				totalFiles: 30,          // keep up to 10 back copies
				rotateExisting: true,  // Give ourselves a clean file when we start up, based on period
				threshold: '10m',      // Rotate log files larger than 10 megabytes
				totalSize: '20m',      // Don't keep more than 20mb of archived log files
				gzip: true             // Compress the archive log files to save space
			})
		}
	]
});

I know that it can add "--time local" to make the time convert to local time by bunyun provided. But I'm using pkg to complie .exe to executable so I can't add "--time local".
I tried to add "timeFormat: 2" into the createLogger object but it's not work. Can I add variable or something else to make the time show in local time?

Thank you