Code Monkey home page Code Monkey logo

ionic-logger's Introduction

Ionic Logger

NPM

Ionic 5 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);
    })
  }
}

ionic-logger's People

Contributors

antonio-spinelli avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ionic-logger's Issues

Metadata version mismatch in production build

Following error comes when try ionic cordova run android --prod

Error: Metadata version mismatch for module C:/Ionic/Ionic-Sample/node_modules/ionic-logger/dist/es2015/src/mod ule.d.ts, found version 4, expected 3 at StaticSymbolResolver.getModuleMetadata (C:\Ionic\Ionic-Sample\node_modules\@angular\compiler\bundles\com piler.umd.js:25748:34) at StaticSymbolResolver._createSymbolsOf (C:\Ionic\Ionic-Sample\node_modules\@angular\compiler\bundles\comp iler.umd.js:25536:46) at StaticSymbolResolver.getSymbolsOf (C:\Ionic\Ionic-Sample\node_modules\@angular\compiler\bundles\compiler .umd.js:25517:14) at C:\Ionic\Ionic-Sample\node_modules\@angular\compiler\bundles\compiler.umd.js:24376:30 at Array.forEach (<anonymous>) at extractProgramSymbols (C:\Ionic\Ionic-Sample\node_modules\@angular\compiler\bundles\compiler.umd.js:2437 5:79) at AotCompiler.analyzeModulesAsync (C:\Ionic\Ionic-Sample\node_modules\@angular\compiler\bundles\compiler.u md.js:23931:47) at CodeGenerator.codegen (C:\Ionic\Ionic-Sample\node_modules\@angular\compiler-cli\src\codegen.js:32:14) at Function.NgTools_InternalApi_NG_2.codeGen (C:\Ionic\Ionic-Sample\node_modules\@angular\compiler-cli\src\ ngtools_api.js:73:30) at C:\Ionic\Ionic-Sample\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:182:73

Example for FileSystem Implementation

I was trying to add the ionic-logger to my ionic project but I have no idea how to implement the file system interface. Can you provide an example for that.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.