Constructor
new Context(optionsopt)
Default constructor
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
ContextOptions |
<optional> |
contxt options |
- Source:
Members
(static) defaults :Object
Default method configs. See defaults.js
for detailed config.
Type:
- Object
- Source:
(static) one :Context
Shared instance with default configuration
Type:
- Source:
Methods
configure(options) → {Context}
Update context with options.
Parameters:
Name | Type | Description |
---|---|---|
options |
ContextOptions | contxt options |
- Source:
Returns:
- current context
- Type
- Context
formatter(name) → {Formatter}
Get a registerd formatter by name. If not formatter has been defined before, a fallback formatter will be returned, which output nothing to stdout/stderr.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | formatter name |
- Source:
Returns:
- the formatter found
- Type
- Formatter
install(type, name, options) → {Context}
Setup a plugin
Parameters:
Name | Type | Description |
---|---|---|
type |
string | plugin type |
name |
string | plugin name |
options |
PluginOptions | plugin options |
- Source:
Returns:
- context it self
- Type
- Context
logger(optionsopt) → {Logger}
Create a logger with options. A logger can have abitary log methods. By defualt, a logger only has info
, debug
, info
, warn
, error
methods.
Each method has its own attributes specified by LoggerOptions
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
LoggerOptions |
<optional> |
options for a logger |
- Source:
Returns:
- created logger
- Type
- Logger