Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nya1/debugdi
debug log package built for Inversify (dependency injection framework), automatically prefix your debug logs with the project name and class name
https://github.com/nya1/debugdi
debug dependency-injection logging typescript
Last synced: 27 days ago
JSON representation
debug log package built for Inversify (dependency injection framework), automatically prefix your debug logs with the project name and class name
- Host: GitHub
- URL: https://github.com/nya1/debugdi
- Owner: nya1
- License: mit
- Created: 2022-07-14T07:48:37.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-08-04T14:59:44.000Z (over 2 years ago)
- Last Synced: 2024-09-14T16:54:35.120Z (about 2 months ago)
- Topics: debug, dependency-injection, logging, typescript
- Language: TypeScript
- Homepage:
- Size: 43.9 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# debugdi
debug log package built for Inversify (dependency injection framework), **automatically** prefix your debug logs with the project name and class name
Example:
```ts
// package.json name "server"
// class TestService ...
debug.log('hello')
```Logs (with DEBUG=server:*):
```
server:TestService hello
```## Install
```bash
yarn add debugdi
```## Usage
In your class inject the `DebugLog` class and call the log method, internally it's using the [debug](https://www.npmjs.com/package/debug) module so you need to enable the debug logs via the env variable `DEBUG=:*`
Example
```ts
export class TestService {
constructor(@inject(DebugLog) private debug: DebugLog) {}myMethod(username: string) {
this.debug.log(`hello ${username}`);
}
}// log output:
// :TestService hello
```