mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 21:01:34 +08:00
Add function for profile loggin in release (#5018)
This commit is contained in:
5
tns-core-modules/profiling/profiling.d.ts
vendored
5
tns-core-modules/profiling/profiling.d.ts
vendored
@ -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;
|
@ -7,6 +7,14 @@ export function uptime() {
|
||||
return global.android ? (<any>org).nativescript.Process.getUpTime() : (<any>global).__tns_uptime();
|
||||
}
|
||||
|
||||
export function log(message: string): void {
|
||||
if ((<any>global).__nslog) {
|
||||
(<any>global).__nslog("CONSOLE LOG: " + message);
|
||||
} else {
|
||||
console.log(message);
|
||||
}
|
||||
}
|
||||
|
||||
interface TimerInfo extends TimerInfoDefinition {
|
||||
totalTime: number;
|
||||
lastTime?: number;
|
||||
|
Reference in New Issue
Block a user