1.0.0 • Published 4 years ago

ionic-logger v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

Ionic Logger

NPM

Ionic 4 plugin providing a logger service.

Installation

For Ionic v2/3 use v0.4.1

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

OptionsTypeDescription
docDirstringDocument directory. Defaults to 'ionic-logger'
logDirstringLog directory inside docDir. Defaults to 'log'
logDayFormatstringDay format. Defaults to 'YYYY-MM-DD'
logHourFormatstringHour format. Defaults to 'HH:mm:ss:SSS'
debugbooleanBoolean 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);
    })
  }
}
0.5.0

4 years ago

1.0.0

4 years ago

0.4.1

6 years ago

0.4.0

6 years ago

0.3.3

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago