Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change time zone to local time in createLogger #716

Open
WayneTvT opened this issue Oct 9, 2023 · 0 comments
Open

Change time zone to local time in createLogger #716

WayneTvT opened this issue Oct 9, 2023 · 0 comments

Comments

@WayneTvT
Copy link

WayneTvT commented Oct 9, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant