y-log-io
Console loging to an other terminal. Useful to not disturb the main terminal output.
This console outputs to an other terminal to avoid disturbing the layout or primary informations of the main terminal output.
Install :
npm install y-log-io
Exemple 1 : base use.
Script 1 : Get your logger (where you execute you code)
const Log= ;var logger=Log;logger;
Script 2 : show output logs.
const Log= ;var output = Log;outputstart;
See exemple_01.
Menu
Get logger
Get the logger. This command returns an instance of Input.
/**get the logger.@param@return */YLogIO
Input
- Properties
- timeout : int default=500.
- Minimal read/write period. The logger wont access the json file more than once evry timeout ms.
- Decrease if you want more responsiveness.
- Increase if you want to limit rw charge.
- maxlog : int default=100.
- maximum logs buffer size. Limits json file size when output is not listening.
- Low value reduce file size and r/w time, but you may loose outputs.
- fileName : string read only
- path to the json file name.
Get Output
Get the logger output. This command returns an instance of Output.
/**get logger output.@param@return */YLogIO
Output
- Methods
- .start : Starts the console output.
/**activate the console.*/Outputstart;
- Properties
-
timeout : int default=2000.
- maximal r/w period (fs.watch leaks fix) forced access to json file if no changes have been detected after timeout ms.
-
splitTimeout : int default=2000.
- display a different log separator when time between log is greater than splitTimeout ms.
-
startMsg : string
- The message displayed when the output starts.
-
stackMax : int default=5.
- displayed stack pile maximum size.
-
show : object
- .startLine : boolean default=true
- Shows startMsg.
- .topLine : boolean default=true
- Shows log separator.
- .info : boolean default=true
- Shows log infos (time method file line).
- .time : boolean default=true
- Shows log time.
- .method : boolean default=true
- Shows log local method.
- .file : boolean default=true
- Shows log current file name.
- .line : boolean default=true
- Shows log current file line number.
- .stack : boolean default=true
- Shows stack pile.
- .startLine : boolean default=true
Aliases
Share the same output among files without caring about different pathes by registering an alias.
/**register an alias name for the logs json file. useful for access in different file pathes.@param@param*/YLogIO
The registration could be done only (but at least) once. Event in a one-shot separated script.
const Log= ;Log;
You can now call logger and output by their alias.
ex logger:
const logger= ;
ex output :
start;