Logging is built-in with ConanJs to provide you with an integrated platform so that you can:
Log meaningful message easily
Log what is happening internally in ConanJs
Fine tune at runtime what should be logged.
ConanData and Asaps both produce ConanJs log messages out of the box.
A logging message has many attributes that are helpful to understand where the message comes from, its information, and also, to make easier to fine tune what should be logged out.
Indicates the nature of the source of this log message. There are seven natures:
The main thread in a Conan state
The meta flow in a Conan state
The monitor thread in a Conan state
The main thread in a Conan state (when the user decides to override the nature)
Log message from an ASAP.
Derived from a Conan State that is created internally by the framework (you are likely to want to have this always turned off)
There are 7 levels. In order of importance (from less important to more important):
A string message describing what is happening
Optionally, there can a payload that will also get logged out.
You can configure what to log at runtime. By default it gets log out everything that is:
MAIN and MILESTONE
To fine tune what gets logged out there are three main methods
Receives the current rules for logging, returns the new rules for logging
Sets the logging rules
Get the current rules.
The following example illustrates how to change the logging levels at runtime