Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function rotateLogFile (num) {
try {
var p = getLogPath(num)
var info = await jetpack.inspectAsync(p)
if (info && info.type === 'file') {
await jetpack.moveAsync(p, getLogPath(num + 1))
}
} catch (err) {
console.error('rotateLogFile failed', num, err)
}
}
async function retireLogFile (num) {
try {
var p = getLogPath(num)
var info = await jetpack.inspectAsync(p)
if (info && info.type === 'file') {
await jetpack.removeAsync(p)
}
} catch (err) {
console.error('retireLogFile failed', num, err)
}
}
async function rotateLogFile (num) {
try {
var p = getLogPath(num)
var info = await jetpack.inspectAsync(p)
if (info && info.type === 'file') {
await jetpack.moveAsync(p, getLogPath(num + 1))
}
} catch (err) {
console.error('rotateLogFile failed', num, err)
}
}
async function retireLogFile (num) {
try {
var p = getLogPath(num)
var info = await jetpack.inspectAsync(p)
if (info && info.type === 'file') {
await jetpack.removeAsync(p)
}
} catch (err) {
console.error('retireLogFile failed', num, err)
}
}