Is there ant way I can silence a warning message caused by a module I include?
I like the module, but every time I call their function, the console outputs:
"Utf8String" type is deprecated, use "CString" instead
I am making a console app, so would prefer to surpress this message.
The warning messages you are getting are actually from node and not the module. The module is however causing the warnings as its calling an api that was used in previous version of node.
I don't think there is anyway to tell node to surpress warning messages logged to the console.
If you really are determind to get rid of these warnings you can go into source code of the module and do a find and replace.
"Utf8String" to "CString"
I did the exact same thing for another module, I couldn't stand those messages either.
In this case, there was a module required by a module I required, which had custom code which both used Utf8String
and triggered an error for it.
// alias Utf8String
var utfstringwarned = false
Object.defineProperty(types, 'Utf8String', {
enumerable: false
, configurable: true
, get: function () {
if (!utfstringwarned) {
utfstringwarned = true
console.error('"Utf8String" type is deprecated, use "CString" instead')
}
return types.CString
}
})
And wrote about it in the history
0.0.20 / 2012-06-27
===================
- rename the `Utf8String` type to `CString` (#5)
- make `Utf8String` an alias to `CString` and deprecated
- more work on docs (not yet ready)
So as a temporary solution, I might comment out the error message, or as a more permanent solution, choose a different module.