Skip to content

Commit

Permalink
adding warning messages
Browse files Browse the repository at this point in the history
  • Loading branch information
kalwalt committed Jan 13, 2022
1 parent 876e9d9 commit c5dec84
Show file tree
Hide file tree
Showing 2 changed files with 106 additions and 5 deletions.
12 changes: 12 additions & 0 deletions include/WebARKit/WebARKitLog.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,17 @@ void webarkitLOGe(char* message, const char * format);

void webarkitLOGe(char* message, int format);

void webarkitLOGw(char* message);

void webarkitLOGw(char* message, double * format);

void webarkitLOGw(char* message, float * format);

void webarkitLOGw(char* message, char * format);

void webarkitLOGw(char* message, const char * format);

void webarkitLOGw(char* message, int format);


#endif // #ifndef WEBARKIT_LOG_H
99 changes: 94 additions & 5 deletions lib/SRC/WebARKit/WebARKitLog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ const char * WARKTinfo = "%cℹ️[webarkit-info:]";
const char * WARKTinfoStyle = "color: #664400; background-color: #ffff99; border-radius: 4px; padding: 2px";
const char * WARKTerror = "%c🚩[webarkit-error:]";
const char * WARKTerrorStyle = "color: #ffffff; background-color: #ff0101; border-radius: 4px; padding: 2px";
const char * WARKTwarn = "%c⚠️[webarkit-warn:]";
const char * WARKTwarnStyle = "color: #774400; background-color: #ffff99; border-radius: 4px; padding: 2px";

void webarkitLOGi(char* message) {
EM_ASM ({
Expand Down Expand Up @@ -111,7 +113,7 @@ void webarkitLOGe(char* message, double * format) {
var errorHead = UTF8ToString($1);
var style = UTF8ToString($2);
var format = UTF8ToString($3);
console.log(errorHead + message, style, format);
console.error(errorHead + message, style, format);
},
message,
WARKTerror,
Expand All @@ -126,7 +128,7 @@ void webarkitLOGe(char* message, float * format) {
var errorHead = UTF8ToString($1);
var style = UTF8ToString($2);
var format = UTF8ToString($3);
console.log(errorHead + message, style, format);
console.error(errorHead + message, style, format);
},
message,
WARKTerror,
Expand All @@ -141,7 +143,7 @@ void webarkitLOGe(char* message, char * format) {
var errorHead = UTF8ToString($1);
var style = UTF8ToString($2);
var format = UTF8ToString($3);
console.log(errorHead + message, style, format);
console.error(errorHead + message, style, format);
},
message,
WARKTerror,
Expand All @@ -156,7 +158,7 @@ void webarkitLOGe(char* message, const char * format) {
var errorHead = UTF8ToString($1);
var style = UTF8ToString($2);
var format = UTF8ToString($3);
console.log(errorHead + message, style, format);
console.error(errorHead + message, style, format);
},
message,
WARKTerror,
Expand All @@ -170,11 +172,98 @@ void webarkitLOGe(char* message, int format) {
var message = UTF8ToString($0);
var errorHead = UTF8ToString($1);
var style = UTF8ToString($2);
console.log(errorHead + message, style, $3);
console.error(errorHead + message, style, $3);
},
message,
WARKTerror,
WARKTerrorStyle,
format
);
}

void webarkitLOGw(char* message) {
EM_ASM ({
var message = UTF8ToString($0);
var infoHead = UTF8ToString($1);
var style = UTF8ToString($2);
console.warn(infoHead + message, style);
},
message,
WARKTwarn,
WARKTwarnStyle
);
}

void webarkitLOGw(char* message, double * format) {
EM_ASM ({
var message = UTF8ToString($0);
var errorHead = UTF8ToString($1);
var style = UTF8ToString($2);
var format = UTF8ToString($3);
console.warn(errorHead + message, style, format);
},
message,
WARKTwarn,
WARKTwarnStyle,
format
);
}

void webarkitLOGw(char* message, float * format) {
EM_ASM ({
var message = UTF8ToString($0);
var errorHead = UTF8ToString($1);
var style = UTF8ToString($2);
var format = UTF8ToString($3);
console.warn(errorHead + message, style, format);
},
message,
WARKTwarn,
WARKTwarnStyle,
format
);
}

void webarkitLOGw(char* message, char * format) {
EM_ASM ({
var message = UTF8ToString($0);
var errorHead = UTF8ToString($1);
var style = UTF8ToString($2);
var format = UTF8ToString($3);
console.warn(errorHead + message, style, format);
},
message,
WARKTwarn,
WARKTwarnStyle,
format
);
}

void webarkitLOGw(char* message, const char * format) {
EM_ASM ({
var message = UTF8ToString($0);
var errorHead = UTF8ToString($1);
var style = UTF8ToString($2);
var format = UTF8ToString($3);
console.warn(errorHead + message, style, format);
},
message,
WARKTwarn,
WARKTwarnStyle,
format
);
}

void webarkitLOGw(char* message, int format) {
EM_ASM ({
var message = UTF8ToString($0);
var errorHead = UTF8ToString($1);
var style = UTF8ToString($2);
console.warn(errorHead + message, style, $3);
},
message,
WARKTwarn,
WARKTwarnStyle,
format
);
}

0 comments on commit c5dec84

Please sign in to comment.