logging fix, see #10
This commit is contained in:
parent
421ab5f05f
commit
442d6d820e
|
@ -89,7 +89,7 @@ function warning ( ...args ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function fatal ( ...args ) {
|
function fatal ( ...args ) {
|
||||||
log( ...args )
|
console.trace( elapsedStr( startTime ), ... args )
|
||||||
osProcess.exit( 1 )
|
osProcess.exit( 1 )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
14
zimmer.js
14
zimmer.js
|
@ -32,7 +32,7 @@ SOFTWARE.
|
||||||
const packageInfo = require('./package.json');
|
const packageInfo = require('./package.json');
|
||||||
const os = require( 'os' )
|
const os = require( 'os' )
|
||||||
const osPath = require( 'path' )
|
const osPath = require( 'path' )
|
||||||
const process = require( 'process' )
|
const osProcess = require( 'process' )
|
||||||
const url = require( 'url' )
|
const url = require( 'url' )
|
||||||
const crypto = require( "crypto" )
|
const crypto = require( "crypto" )
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ function mimeFromIndex ( idx ) {
|
||||||
function mimeTypeIndex ( mimeType ) {
|
function mimeTypeIndex ( mimeType ) {
|
||||||
if ( mimeType == null ) {
|
if ( mimeType == null ) {
|
||||||
console.trace( 'No mime type found', mimeType )
|
console.trace( 'No mime type found', mimeType )
|
||||||
process.exit( 1 )
|
osProcess.exit( 1 )
|
||||||
}
|
}
|
||||||
if ( mimeType == REDIRECT_MIME )
|
if ( mimeType == REDIRECT_MIME )
|
||||||
return 0xffff
|
return 0xffff
|
||||||
|
@ -185,7 +185,7 @@ function warning ( ...args ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function fatal ( ...args ) {
|
function fatal ( ...args ) {
|
||||||
log( ...args )
|
console.trace( elapsedStr( startTime ), ... args )
|
||||||
osProcess.exit( 1 )
|
osProcess.exit( 1 )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,8 +297,7 @@ class Writer {
|
||||||
this.stream = fs.createWriteStream( path, { highWaterMark: 1024*1024*10 })
|
this.stream = fs.createWriteStream( path, { highWaterMark: 1024*1024*10 })
|
||||||
this.stream.once( 'open', fd => { })
|
this.stream.once( 'open', fd => { })
|
||||||
this.stream.on( 'error', err => {
|
this.stream.on( 'error', err => {
|
||||||
console.trace( 'Writer error', this.stream.path, err )
|
fatal( 'Writer error', this.stream.path, err )
|
||||||
process.exit( 1 )
|
|
||||||
})
|
})
|
||||||
|
|
||||||
this.queue = genericPool.createPool(
|
this.queue = genericPool.createPool(
|
||||||
|
@ -480,8 +479,7 @@ class ClusterPool {
|
||||||
if ( data == null || data.length == 0 )
|
if ( data == null || data.length == 0 )
|
||||||
return false
|
return false
|
||||||
if ( !mimeType ) {
|
if ( !mimeType ) {
|
||||||
console.error( 'isCompressible !mimeType', mimeType, data, id )
|
fatal( 'isCompressible !mimeType', mimeType, data, id )
|
||||||
process.exit( 1 )
|
|
||||||
}
|
}
|
||||||
if ( mimeType == 'image/svg+xml' || mimeType.split( '/' )[ 0 ] == 'text' )
|
if ( mimeType == 'image/svg+xml' || mimeType.split( '/' )[ 0 ] == 'text' )
|
||||||
return true
|
return true
|
||||||
|
@ -1580,7 +1578,7 @@ function main () {
|
||||||
.option( '--optimg', 'optimise images' )
|
.option( '--optimg', 'optimise images' )
|
||||||
.option( '--jpegquality <factor>', 'JPEG quality', parseInt, 60 )
|
.option( '--jpegquality <factor>', 'JPEG quality', parseInt, 60 )
|
||||||
.option( '--no-compress', "do not compress clusters" )
|
.option( '--no-compress', "do not compress clusters" )
|
||||||
.parse( process.argv )
|
.parse( osProcess.argv )
|
||||||
|
|
||||||
log( argv )
|
log( argv )
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user