An open API service indexing awesome lists of open source software.

https://github.com/christophhu/ngx-log-mode

The ngx-log-mode repostory is a demo application of the ngx-log-mode library. The library adds a simple toggle-component to activate or deactivate the log-mode of your application. It is possible to configure the log-level and log-mode (console, localstorage, sessionstorage or webAPI).
https://github.com/christophhu/ngx-log-mode

angular console demo localstorage logging ngx webapi

Last synced: 4 months ago
JSON representation

The ngx-log-mode repostory is a demo application of the ngx-log-mode library. The library adds a simple toggle-component to activate or deactivate the log-mode of your application. It is possible to configure the log-level and log-mode (console, localstorage, sessionstorage or webAPI).

Awesome Lists containing this project

README

          

# Ngx-Log-Mode

## Frameworks and Languages


Static Badge

Static Badge

Static Badge

## Demo


image

## Description
This Repository is a demo application for the ngx-log-mode library. The ngx-log-mode library is a simple logger for Angular applications. It provides a simple API to log messages to the console, localstorage or to a customizable RestAPI. The library is easy to use and can be installed via [npm](https://www.npmjs.com/package/@christophhu/ngx-log-mode).

## Installation
To run this project, you need to have Node.js installed on your machine. Clone the repository and run the following commands:

```bash
npm i @christophhu/ngx-log-mode
```

## Use
### With default toggle
```html

```

### With custom toggle
```html

```

```typescript
import { LogDecorator, LogModeComponent, LogService } from '@christophhu/ngx-log-mode'

@Component({
...
imports: [
LogModeComponent
],
providers: [
LogService
]
})
export class TestComponent {
private _logService: LogService

constructor(@Inject(LogService) _logService: LogService) {
this._logService = _logService
}

// Log-Decorator to log the function call and the result with timestamp
@LogDecorator({ logType: 'info', input: false, output: false, timestamp: true })

toggleLog() {
this._logService.toggleLogActivate()
}
isLogActivated(): boolean {
return this._logService.isLogActivated()
}

logThis(param: string): void {
LogService.log('TemplateComponent', 'logThis()', ' param: ' + param)
}
logThis() {
LogService.debug('TemplateComponent', 'logDebug()')
LogService.info('TemplateComponent', 'logInfo()')
LogService.warn('TemplateComponent', 'logWarn()')
LogService.error('TemplateComponent', 'logError()')
LogService.fatal('TemplateComponent', 'logFatal()')
}
}
```