Merge pull request #910 from andreasbrett/logging

introduce consistent logging
This commit is contained in:
Louis Lam 2022-04-13 23:47:08 +08:00 committed by GitHub
commit 17dcf6d3a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 332 additions and 180 deletions

View file

@ -3,6 +3,7 @@
Modified with 0 dependencies
*/
let fs = require("fs");
const { log } = require("../src/util");
let ImageDataURI = (() => {
@ -14,7 +15,7 @@ let ImageDataURI = (() => {
*/
function decode(dataURI) {
if (!/data:image\//.test(dataURI)) {
console.log("ImageDataURI :: Error :: It seems that it is not an Image Data URI. Couldn't match \"data:image/\"");
log.error("image-data-uri", "It seems that it is not an Image Data URI. Couldn't match \"data:image/\"");
return null;
}
@ -35,7 +36,7 @@ let ImageDataURI = (() => {
*/
function encode(data, mediaType) {
if (!data || !mediaType) {
console.log("ImageDataURI :: Error :: Missing some of the required params: data, mediaType ");
log.error("image-data-uri", "Missing some of the required params: data, mediaType");
return null;
}