Class: Logger

Logger()

A basic logger that writes logs to the local file system

Constructor

new Logger()

Source:

Extends

Members

path

Returns the path to the log file
Source:

Methods

_readObject(input) → {Object}

Parse an Object into a corresponding Fabric state.
Parameters:
Name Type Description
input Object Object to read as input.
Overrides:
Source:
Returns:
Fabric state.
Type
Object

adopt(changes) → {Actor}

Explicitly adopt a set of JSONPatch-encoded changes.
Parameters:
Name Type Description
changes Array List of JSONPatch operations to apply.
Overrides:
Source:
Returns:
Instance of the Actor.
Type
Actor

commit() → {String}

Resolve the current state to a commitment.
Overrides:
Source:
Returns:
32-byte ID
Type
String

export() → {Object}

Export the Actor's state to a standard Object.
Overrides:
Source:
Returns:
Standard object.
Type
Object

get(path) → {Object}

Retrieve a value from the Actor's state by JSONPointer path.
Parameters:
Name Type Description
path String Path to retrieve using JSONPointer.
Overrides:
Source:
Returns:
Value of the path in the Actor's state.
Type
Object

log(msg) → {Boolean}

Writes the specified log to the log file
Parameters:
Name Type Description
msg String | Object The message to log
Source:
Returns:
true, if msg was successfully written; false otherwise
Type
Boolean

pause() → {Actor}

Toggles `status` property to paused.
Overrides:
Source:
Returns:
Instance of the Actor.
Type
Actor

serialize() → {String}

Serialize the Actor's current state into a JSON-formatted string.
Overrides:
Source:
Returns:
Type
String

set(path, value) → {Object}

Set a value in the Actor's state by JSONPointer path.
Parameters:
Name Type Description
path String Path to set using JSONPointer.
value Object Value to set.
Overrides:
Source:
Returns:
Value of the path in the Actor's state.
Type
Object

sign() → {Actor}

Signs the Actor.
Overrides:
Source:
Returns:
Type
Actor

(async) start() → {Promise}

Starts the logger This method creates the required directories for writing the log file.
Source:
Returns:
Type
Promise

stop() → {Promise}

Stops the logger This method closes the log file and returns after it has been closed. Any errors on close would cause the return promise to be rejected.
Source:
Returns:
Type
Promise

toBuffer() → {Buffer}

Casts the Actor to a normalized Buffer.
Overrides:
Source:
Returns:
Type
Buffer

toGenericMessage() → {Object}

Casts the Actor to a generic message.
Overrides:
Source:
Returns:
Generic message object.
Type
Object

toObject() → {Object}

Returns the Actor's current state as an Object.
Overrides:
Source:
Returns:
Type
Object

unpause() → {Actor}

Toggles `status` property to unpaused.
Overrides:
Source:
Returns:
Instance of the Actor.
Type
Actor

value(formatopt) → {Object}

Get the inner value of the Actor with an optional cast type.
Parameters:
Name Type Attributes Default Description
format String <optional>
object Cast the value to one of: `buffer, hex, json, string`
Overrides:
Source:
Returns:
Inner value of the Actor as an Object, or cast to the requested `format`.
Type
Object