mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 04:41:36 +08:00
Add a flag we can use to skip string template calcs in release
This commit is contained in:
7
trace/trace.d.ts
vendored
7
trace/trace.d.ts
vendored
@ -11,6 +11,13 @@ declare module "trace" {
|
||||
* Disables the trace module.
|
||||
*/
|
||||
export function disable(): void;
|
||||
|
||||
/**
|
||||
* A field that indicates if the tracer is enabled and there is a point in writing messages.
|
||||
* Check this to avoid writing complex string templates.
|
||||
* Send error messages should even if tracing is disabled.
|
||||
*/
|
||||
export var enabled: boolean;
|
||||
|
||||
/**
|
||||
* Adds a TraceWriter instance to the trace module.
|
||||
|
@ -1,17 +1,17 @@
|
||||
import definition = require("trace");
|
||||
import * as types from "utils/types";
|
||||
|
||||
var _enabled = false;
|
||||
export var enabled = false;
|
||||
var _categories = {};
|
||||
var _writers: Array<definition.TraceWriter> = [];
|
||||
var _eventListeners: Array<definition.EventListener> = [];
|
||||
|
||||
export function enable() {
|
||||
_enabled = true;
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
export function disable() {
|
||||
_enabled = false;
|
||||
enabled = false;
|
||||
}
|
||||
|
||||
export function isCategorySet(category: string): boolean {
|
||||
@ -56,7 +56,7 @@ export function write(message: any, category: string, type?: number) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!_enabled) {
|
||||
if (!enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ export function write(message: any, category: string, type?: number) {
|
||||
}
|
||||
|
||||
export function notifyEvent(object: Object, name: string, data?: any) {
|
||||
if (!_enabled) {
|
||||
if (!enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user