1.3.8 • Published 3 years ago

react-terminal-logger v1.3.8

Weekly downloads
57
License
ISC
Repository
github
Last release
3 years ago

React terminal logger

npm

Simple console logger for vue, react and react-native

New Features!

  • Saving logs to a file (optional)
  • Short alias for console.log

Getting Started

To install the module, run the following in the command line:

npm i react-terminal-logger --save

Use within your application with the following line of JavaScript:

const ReactLogger = require('react-terminal-logger/console-logger');

or

import ReactLogger from 'react-terminal-logger/console-logger'

Run this command in your project's index file:

ReactLogger.start(); //Quick start with standard configuration

To run the logger in the terminal, you need to run the command in your project directory:

npx react-terminal-logger

You can specify the port on which the logger will run:

npx react-terminal-logger --p=1234

Configuration

You can specify what information to show in the terminal:

ReactLogger.start(
    ["log", "error", "info", "warn", "logr"], //You can specify what information to show in the terminal
    true, //Save logs to a file. Your logs will be saved in directory react-logger-logs. Default: false
    true, //Show only message in terminal. Ignores the value of stacktrace_hide. Default: false
    1234, //Port on which the logger is running. Default: 1234
    true //Hide stacktrace. Default: false
);

or

ReactLogger.config({
    visible : ["log", "error", "info", "warn", "logr"], //You can specify what information to show in the terminal
    save_logs: true, //Save logs to a file. Your logs will be saved in directory react-logger-logs. Default: false
    only_msg : true, //Show only message in terminal. Ignores the value of stacktrace_hide. Default: false
    port: 1234, //Port on which the logger is running. Default: 1234
    stacktrace_hide: true //Hide stacktrace. Default: false
});
ReactLogger.start();

In addition to the standard console.log, console.info, console.error, console.warn added a quick command for logging:

logr("your log"); //window.logr("your log")
logr("your log", 1, [{"a1": 1}]); //window.logr("your log", 1, [{"a1": 1}])

You can use this command anywhere, it is enough to include our module in the index file.

1.3.7

3 years ago

1.3.8

3 years ago

1.3.6

3 years ago

1.3.5

3 years ago

1.3.4

3 years ago

1.3.3

3 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.7

3 years ago

1.2.6

3 years ago

1.2.5

3 years ago

1.2.4

3 years ago

1.2.3

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago