# @finlexlabs/logger

Latest version **0.0.1** (published 2020-05-11) · 0 weekly downloads

## Install

```sh
npm install @finlexlabs/logger
pnpm add @finlexlabs/logger
yarn add @finlexlabs/logger
bun add @finlexlabs/logger
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2020-05-11 |
| First published | 2020-05-11 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | samiurrehman.finlexde, muhammad.saeed, miladrezazadeh |

## Links

- npm: https://www.npmjs.com/package/@finlexlabs/logger
- npm.io page: https://npm.io/package/@finlexlabs/logger

## Recent versions

- 0.0.1 (latest) — 2020-05-11

## README

# FinlexLogger (@finlexlabs/logger)


Library Name: finlex-logger

Package Name: @finlexlabs/logger

Repo Name: fx-ng-components

## Description:
There's a lot of risk in instantiating the logger outside of angular's DI that the logger updates it's dependencies and breaks your code.

The solution is to instantiate the logger using a class that supports Angular DI, and create a singleton that your non-angular files can use.

Import logger in any of the non-angular files you can just import the instance of NGXLogger.

 

## When to use this module:

Only when the angular’s dependency is not available (e.g. model, a class outside angular, etc)

## When not to use this module:

If the ngx-logger can be imported and instantiated using the normal Angular DI (e.g. components, services, pipes that have angular DI available).


--------------------------------

Steps to Build & Publish Library

--------------------------------


## Package Renaming


Go to `./src/finlex-logger/package.json`

Rename package name from `finlex-logger` to `@finlexlabs/logger`



## Build


 `npm run build:logger`


It will build finlex-logger using ng-packagr.

The build artifacts will be stored in the `dist/` directory.



## Publishing


After building your library with `ng build:logger`, go to the dist folder `cd dist/finlex-logger` and run `npm publish`.


---
# FinlexLogger


#### app.component.ts
Instantiate the logger
```
import { NGXLogger } from 'ngx-logger';
import { initLogger, logger } from '@finlexlabs/logger';

constructor( logger: NGXLogger ) {
    initLogger(logger);
}
```

#### file.ts
Import `logger` into files where angular's DI is not available
```
import { logger } from '@finlexlabs/logger';


logger.debug("Debug message");
logger.error("error message");
logger.warn("warn message");
```

---
_Source: https://npm.io/package/@finlexlabs/logger · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
