提交 df7c1d57 编写于 作者: fxy060608's avatar fxy060608

fix(app): fallback to console when __log__ is not found

上级 e98c13db
...@@ -656,7 +656,13 @@ function parseUrl(url) { ...@@ -656,7 +656,13 @@ function parseUrl(url) {
function formatAppLog(type, filename, ...args) { function formatAppLog(type, filename, ...args) {
// @ts-ignore // @ts-ignore
uni.__log__ && uni.__log__(type, filename, ...args); if (uni.__log__) {
// @ts-ignore
uni.__log__(type, filename, ...args);
}
else {
console[type].apply(console, [...args, filename]);
}
} }
function formatH5Log(type, filename, ...args) { function formatH5Log(type, filename, ...args) {
console[type].apply(console, [...args, filename]); console[type].apply(console, [...args, filename]);
......
...@@ -652,7 +652,13 @@ function parseUrl(url) { ...@@ -652,7 +652,13 @@ function parseUrl(url) {
function formatAppLog(type, filename, ...args) { function formatAppLog(type, filename, ...args) {
// @ts-ignore // @ts-ignore
uni.__log__ && uni.__log__(type, filename, ...args); if (uni.__log__) {
// @ts-ignore
uni.__log__(type, filename, ...args);
}
else {
console[type].apply(console, [...args, filename]);
}
} }
function formatH5Log(type, filename, ...args) { function formatH5Log(type, filename, ...args) {
console[type].apply(console, [...args, filename]); console[type].apply(console, [...args, filename]);
......
...@@ -4,7 +4,12 @@ export function formatAppLog( ...@@ -4,7 +4,12 @@ export function formatAppLog(
...args: unknown[] ...args: unknown[]
) { ) {
// @ts-ignore // @ts-ignore
uni.__log__ && uni.__log__(type, filename, ...args) if (uni.__log__) {
// @ts-ignore
uni.__log__(type, filename, ...args)
} else {
;(console[type] as Function).apply(console, [...args, filename])
}
} }
export function formatH5Log( export function formatH5Log(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册