2

I'm writing custum angular upgrade schematics.

The SchematicContext contains a logger object which can be usefull to debug.

 context.logger.debug('This logger seems to be usefull!');   

Running angular-cli, my code is executed but I can't see the logs.

Is there a mean to activate and configure this logger ?

Sh. Pavel
  • 1,584
  • 15
  • 28
antoine
  • 93
  • 7

3 Answers3

1

I dont think debug is visible by default level of logging. Trying changing logging level to info or above.

Ben
  • 836
  • 1
  • 9
  • 19
  • Any reason why debug wouldn't be visible? I tried going through the source code and couldn't see any difference with the debug method vs info, warn, etc. – Jesse Mar 11 '19 at 18:44
1

The help says to use --verbose but it doesn't work.

$ ng add --help
options:
  --verbose 
    Display additional details about internal operations during execution.

The proper solution is to set the env variable NG_DEBUG to true.

# On macOS:
$ NG_DEBUG=true ng add @scope/my-schematic
Badisi
  • 469
  • 1
  • 3
  • 12
0

I also can't get .debug to do anything. The other methods work, though: warn, error, info, etc., so at least those are useful. Just be sure to run "yarn build" before running it.

Jesse
  • 2,391
  • 14
  • 15