diff --git a/tns-core-modules/profiling/profiling.d.ts b/tns-core-modules/profiling/profiling.d.ts index da84fd59f..350e86a8e 100644 --- a/tns-core-modules/profiling/profiling.d.ts +++ b/tns-core-modules/profiling/profiling.d.ts @@ -128,3 +128,8 @@ export declare function stopCPUProfile(name: string): void; * Gets the uptime of the current process in milliseconds. */ export function uptime(): number; + +/** + * Logs important messages. Contrary to console.log's behavior, the profiling log should output even for release builds. + */ +export function log(message: string): void; \ No newline at end of file diff --git a/tns-core-modules/profiling/profiling.ts b/tns-core-modules/profiling/profiling.ts index 456cc6a27..b787c9582 100644 --- a/tns-core-modules/profiling/profiling.ts +++ b/tns-core-modules/profiling/profiling.ts @@ -7,6 +7,14 @@ export function uptime() { return global.android ? (org).nativescript.Process.getUpTime() : (global).__tns_uptime(); } +export function log(message: string): void { + if ((global).__nslog) { + (global).__nslog("CONSOLE LOG: " + message); + } else { + console.log(message); + } +} + interface TimerInfo extends TimerInfoDefinition { totalTime: number; lastTime?: number; @@ -285,4 +293,4 @@ export function stopCPUProfile(name: string) { if (anyGlobal.android) { __stopCPUProfiler(name); } -} \ No newline at end of file +}