Foundation.Logger
Buffer for log messages which can be directly retrieved, or piped to a console in immediate or buffer mode.
Example
// Create a logger instance (which buffers)
var logger = new Foundation.Logger();
// Log some messages
logger.log("Some event");
logger.warn("Something doesn't look right");
logger.error("Something broke");
// Dump message to console and discard from buffer
logger.dumpLog();
Implementation Details
Reference paths
'/foundation/_digest.ts''/foundation/core/debugging/_digest.ts''/foundation/core/debugging/Logger.ts'
Extends
This type does not extend a base type.
Implements
This type does not implement any interfaces
Public Properties
messages : {type: string, message: string}[]
- Buffered messages. type will be one of "log", "warn", or "error"
immediate: boolean
- If true, logged messages will be dumped straight to the console. If false, messages will be buffered.
Constructors
(immediate: boolean = false)
- See
immediateproperty description.
Instance Methods
log(m: string): void
- Log a standard message. Will be dumped as console.log
warn(m: string): void
- Log a warning message. Will be dumped as console.warn
error(m: string): void
- Log an error message. Will be dumped as console.error
dumpLog(clear: boolean = true): void
- Dump all logged messages to the console. By default all dumped messages will then be discarded from the buffer. Pass
falseforclearto avoid this.