mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 15:25:07 +01:00
Emit 'warning' event for non-critical problems #2032
This commit is contained in:
@@ -45,8 +45,13 @@ const debuglog = util.debuglog('sharp');
|
||||
* JPEG, PNG, WebP or TIFF format image data can be streamed out from this object.
|
||||
* When using Stream based output, derived attributes are available from the `info` event.
|
||||
*
|
||||
* Non-critical problems encountered during processing are emitted as `warning` events.
|
||||
*
|
||||
* Implements the [stream.Duplex](http://nodejs.org/api/stream.html#stream_class_stream_duplex) class.
|
||||
*
|
||||
* @emits Sharp#info
|
||||
* @emits Sharp#warning
|
||||
*
|
||||
* @example
|
||||
* sharp('input.jpg')
|
||||
* .resize(300, 200)
|
||||
@@ -230,7 +235,10 @@ const Sharp = function (input, options) {
|
||||
linearA: 1,
|
||||
linearB: 0,
|
||||
// Function to notify of libvips warnings
|
||||
debuglog: debuglog,
|
||||
debuglog: warning => {
|
||||
this.emit('warning', warning);
|
||||
debuglog(warning);
|
||||
},
|
||||
// Function to notify of queue length changes
|
||||
queueListener: function (queueLength) {
|
||||
Sharp.queue.emit('change', queueLength);
|
||||
|
||||
Reference in New Issue
Block a user