Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@node-ts/logger-core

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@node-ts/logger-core - npm Package Compare versions

Comparing version 0.0.15 to 0.0.16

dist/auto-bind-logger.d.ts

1

dist/index.d.ts

@@ -8,1 +8,2 @@ export * from './logger';

export * from './bind-logger';
export * from './auto-bind-logger';

@@ -9,2 +9,3 @@ "use strict";

tslib_1.__exportStar(require("./bind-logger"), exports);
tslib_1.__exportStar(require("./auto-bind-logger"), exports);
//# sourceMappingURL=index.js.map

4

package.json
{
"name": "@node-ts/logger-core",
"version": "0.0.15",
"version": "0.0.16",
"description": "Defines a logging adapter contract between consumers and implementations",

@@ -38,3 +38,3 @@ "main": "./dist/index.js",

},
"gitHead": "d3cf9fba35f5f1446c6fea69c31881ecc86c0049"
"gitHead": "d6edb3920787699ba22c48d2770ee77865922b1f"
}

@@ -156,2 +156,3 @@ # @node-ts/logger-core

import { MyService } from './my-service'
import { MyOtherService } from './my-other-service'

@@ -162,3 +163,9 @@ export class ApplicationContainer extends Container {

super (bind => {
bind(MyService).toSelf()
// Create and bind a logger named 'MyService'
bindLogger(bind, MyService)
bind(MyOtherService).toSelf()
// Create and bind a logger named 'MyOtherService'
bindLogger(bind, MyOtherService)
})

@@ -172,1 +179,30 @@ }

```
## Automatically binding named loggers
In the above example, a named logger is explicitly defined for each target it's to be injected into. To automatically bind all usages of `LOGGER_SYMBOLS.Logger` to a named logger for that target type, use `autoBindLogger()` instead:
```typescript
// application-container.ts
import { Container } from 'inversify'
import { LoggerModule, autoBindLogger } from '@node-ts/logger-core'
import { MyService } from './my-service'
import { MyOtherService } from './my-other-service'
export class ApplicationContainer extends Container {
constructor () {
super (bind => {
bind(MyService).toSelf()
bind(MyOtherService).toSelf()
// Creates new named loggers for all targets in the container, including the above services
autoBindLogger(bind)
})
}
start (): void {
this.load(new LoggerModule())
}
}
```

@@ -8,1 +8,2 @@ export * from './logger'

export * from './bind-logger'
export * from './auto-bind-logger'

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc