Reference Source
public class | source

Loggable

Base class to deal with traces.

Example:

API:
		get_context():string - get instance context.
		get_class):string - get instance class.
		get_name():string - get instance name.

		should_trace(arg_traces_cfg:plain object):boolean - test if loggers should trace this instance.

		get_logger_manager():LoggerManager
		update_trace_enabled():nothing

		enable_trace():nothing
		disable_trace():nothing
		get_trace():boolean
		set_trace(arg_value):nothing
		toggle_trace():nothing

		debug(...args):nothing
		info(...args):nothing
		warn(...args):nothing
		error(...args):nothing

		enter_group(arg_group) leave_group(arg_group):nothing
		separate_level_1():nothing
		separate_level_2():nothing
		separate_level_3():nothing

Constructor Summary

Public Constructor
public

constructor(arg_log_context: string, arg_logger_manager: LoggerManager): nothing

Create a Loggable instance.

Member Summary

Public Members
public

Log context.

public

Class type flag.

public

Trace is enabled for this flag.

Private Members
private

Logger manager instance (default undefined)

Method Summary

Public Methods
public

debug(args: string | array): nothing

Trace DEBUG formatted message.

public

disable_trace(): nothing

Disable traces.

public

enable_trace(): nothing

Enable traces.

public

enter_group(arg_group: string): nothing

Trace INFO message on "enter trace group".

public

error(args: string | array): nothing

Trace ERROR formatted message.

public

Define get class name method for non Instance classes.

public

Get instance context.

public

Get logger manager.

public

Define get instance name method for non Instance classes.

public

Get trace flag.

public

info(args: string | array): nothing

Trace INFO formatted message.

public

leave_group(arg_group: string): nothing

Trace INFO message on "leave trace group".

public

separate_level_1(): nothing

Trace INFO trace level 1 separator.

public

separate_level_2(): nothing

Trace INFO trace level 2 separator.

public

separate_level_3(): nothing

Trace INFO trace level 3 separator.

public

set_trace(arg_value: boolean): nothing

Set trace flag.

public

should_trace(arg_traces_cfg: object): boolean

Calculate should trace flag.

public

should_trace_class(arg_traces_cfg: object): boolean

Calculate should trace flag for classes.

public

should_trace_collection_item(arg_traces_cfg: object, arg_collection_name: string, arg_this_item_accessor: string): boolean

Calculate should trace flag for given collection of names or patterns.

public

should_trace_module(arg_traces_cfg: object): boolean

Calculate should trace flag for modules.

public

should_trace_name(arg_traces_cfg: object): boolean

Calculate should trace flag for instances names.

public

Toggle trace flag.

public

Update trace enabled flag.

public

warn(args: string | array): nothing

Trace WARN formatted message.

Public Constructors

public constructor(arg_log_context: string, arg_logger_manager: LoggerManager): nothing source

Create a Loggable instance.

Params:

NameTypeAttributeDescription
arg_log_context string

trace context.

arg_logger_manager LoggerManager

logger manager instance.

Return:

nothing

Public Members

public $context: string source

Log context.

public is_loggable: boolean source

Class type flag.

public is_trace_enabled: boolean source

Trace is enabled for this flag.

Private Members

private _logger_manager: LoggerManager source

Logger manager instance (default undefined)

Public Methods

public debug(args: string | array): nothing source

Trace DEBUG formatted message.

Params:

NameTypeAttributeDescription
args string | array

variadic messages to format.

Return:

nothing

public disable_trace(): nothing source

Disable traces.

Return:

nothing

public enable_trace(): nothing source

Enable traces.

Return:

nothing

public enter_group(arg_group: string): nothing source

Trace INFO message on "enter trace group".

Params:

NameTypeAttributeDescription
arg_group string

trace group name.

Return:

nothing

public error(args: string | array): nothing source

Trace ERROR formatted message.

Params:

NameTypeAttributeDescription
args string | array

variadic messages to format.

Return:

nothing

public get_class(): string source

Define get class name method for non Instance classes.

Return:

string

public get_context(): string source

Get instance context.

Return:

string

public get_logger_manager(): LoggerManager source

Get logger manager.

Return:

LoggerManager

public get_name(): string source

Define get instance name method for non Instance classes.

Return:

string

public get_trace(): boolean source

Get trace flag.

Return:

boolean

public info(args: string | array): nothing source

Trace INFO formatted message.

Params:

NameTypeAttributeDescription
args string | array

variadic messages to format.

Return:

nothing

public leave_group(arg_group: string): nothing source

Trace INFO message on "leave trace group".

Params:

NameTypeAttributeDescription
arg_group string

trace group name.

Return:

nothing

public separate_level_1(): nothing source

Trace INFO trace level 1 separator.

Return:

nothing

public separate_level_2(): nothing source

Trace INFO trace level 2 separator.

Return:

nothing

public separate_level_3(): nothing source

Trace INFO trace level 3 separator.

Return:

nothing

public set_trace(arg_value: boolean): nothing source

Set trace flag.

Params:

NameTypeAttributeDescription
arg_value boolean

trace flag.

Return:

nothing

public should_trace(arg_traces_cfg: object): boolean source

Calculate should trace flag.

Params:

NameTypeAttributeDescription
arg_traces_cfg object

traces settings object as { modules:{ 'pattern':boolean }, classes:{ 'pattern':boolean }, instances:{ 'pattern':boolean } }.

Return:

boolean

trace flag.

public should_trace_class(arg_traces_cfg: object): boolean source

Calculate should trace flag for classes.

Params:

NameTypeAttributeDescription
arg_traces_cfg object

traces settings object as { modules:{}, classes:{}, instances:{} }

Return:

boolean

trace flag.

public should_trace_collection_item(arg_traces_cfg: object, arg_collection_name: string, arg_this_item_accessor: string): boolean source

Calculate should trace flag for given collection of names or patterns.

Params:

NameTypeAttributeDescription
arg_traces_cfg object

traces settings object as { modules:{ 'pattern':boolean }, classes:{}, instances:{} }.

arg_collection_name string

'modules' or 'classes' or 'instances'

arg_this_item_accessor string

this method name to access attribute value.

Return:

boolean

trace flag.

public should_trace_module(arg_traces_cfg: object): boolean source

Calculate should trace flag for modules.

Params:

NameTypeAttributeDescription
arg_traces_cfg object

traces settings object as { modules:{}, classes:{}, instances:{} }

Return:

boolean

trace flag.

public should_trace_name(arg_traces_cfg: object): boolean source

Calculate should trace flag for instances names.

Params:

NameTypeAttributeDescription
arg_traces_cfg object

traces settings object as { modules:{}, classes:{}, instances:{} }

Return:

boolean

trace flag.

public toggle_trace(): boolean source

Toggle trace flag.

Return:

boolean

public update_trace_enabled(): nothing source

Update trace enabled flag.

Return:

nothing

public warn(args: string | array): nothing source

Trace WARN formatted message.

Params:

NameTypeAttributeDescription
args string | array

variadic messages to format.

Return:

nothing