ngrx-command-line-logger
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

Ngrx Command Line Logger

Print in the terminal your project NGRX actions via websockets.

Example action

Installing

$ npm i --save-dev ngrx-command-line-logger

Usage

Add ngrx-command-line-logger as ngrx meta-reducer.

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { StoreModule } from '@ngrx/store';
import { reducers, metaReducers } from './reducers';
import { environment } from '../environments/environment';
import { CommandLineLogger } from 'ngrx-command-line-logger';
 
export const metaReducers: MetaReducer<State>[] = !environment.production ? [] : [];
 
metaReducers.push(CommandLineLogger({
  port: 8080 // default
}));
 
@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    StoreModule.forRoot(reducers, {
      metaReducers
    })
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

Run the repl logger

$ npx ngrx-cll --port 8080

REPL

$.client({}): Send an object to the client devtools.

> $.client($.history)
> $.client() // last state

Example client command

$.history: Last 100 entries (state, action & diff).

$.last: Last entry.

$.state: Current state.

$.log({}): Deep JSON log. Example: $.log($.state)

Readme

Keywords

Package Sidebar

Install

npm i ngrx-command-line-logger

Weekly Downloads

1

Version

1.2.0

License

ISC

Unpacked Size

1.19 MB

Total Files

19

Last publish

Collaborators

  • juanfran