ionic-logger-new
TypeScript icon, indicating that this package has built-in type declarations

0.4.9 • Public • Published

Ionic Logger

This plugin is modified to add an option to skip the writing to file and log rotations

NPM

Ionic 2+ plugin providing a logger service.

Installation

Make sure you have Ionic and Angular installed.

npm install --save ionic-logger

Check you peer-dependencies warnings after npm install to make sure you are using a version in accordance to your Ionic version.

Import

import { IonicLoggerModule, Logger } from 'ionic-logger';

@NgModule({
  imports: [
    IonicLoggerModule.forRoot({
      docDir: 'MyApp',
      logDir: 'log'
    })
  ],
  providers: [
    Logger
  ]
})
export class AppModule {}

Config

Options Type Description
docDir string Document directory. Defaults to 'ionic-logger'
logDir string Log directory inside docDir. Defaults to 'log'
logDayFormat string Day format. Defaults to 'YYYY-MM-DD'
logHourFormat string Hour format. Defaults to 'HH:mm:ss:SSS'
debug boolean Boolean to enable debug mode. Defaults to false

Example

  • app.component.ts
import { Platform } from 'ionic-angular';
import { Logger } from 'ionic-logger';
import { FileSystemService } from './file-system.service'; // your own service or model that implements ionic-logger FileSystem interface

...

constructor(
  private logger: Logger,
  private platform: Platform
) {
  this.platform.ready().then(() => {

    ...

    this.logger.init(fileSystemService).then((status) => {
      this.logger.debug('[Logger] init: ' + status);
    })
  }
}

Package Sidebar

Install

npm i ionic-logger-new

Weekly Downloads

0

Version

0.4.9

License

MIT

Unpacked Size

67.8 kB

Total Files

36

Last publish

Collaborators

  • robotikka