Constructor
# new FabricLogger(context, conf)
Adapts the decaf-ts MiniLogger to route messages through a per-context Fabric logger, honoring configured log levels and formatting.
Logger implementation tailored for Hyperledger Fabric clients.
sequenceDiagram
autonumber
participant C as Caller
participant FL as FabricLogger
participant ML as MiniLogger (delegate)
C->>FL: info('Processing transaction')
FL->>FL: createLog(level,msg,stack)
FL->>ML: info(log)
C->>FL: error(new Error('x'))
FL->>FL: createLog(level,msg,stack)
FL->>ML: error(log)
Parameters:
| Name | Type | Description |
|---|---|---|
context |
string
|
The logging context name used to scope the logger instance. |
conf |
Partial.<LoggingConfig>
|
undefined
|
Optional logging configuration to override defaults for this context. |
Example
```typescript
// In a Fabric client/service
const logger = new FabricLogger('MyFabricService', { level: 'info' });
logger.info('Processing transaction');
logger.debug('Transaction details', { txId: '123' });
logger.error('Something went wrong');
```
Members
Methods
# protected log(level, msg, stackopt) → {void}
Overrides the base MiniLogger.log to forward to the internal Fabric-aware logger, enforcing configured thresholds.
Logs a message at the specified level.
sequenceDiagram
autonumber
participant C as Caller
participant FL as FabricLogger
participant ML as MiniLogger (delegate)
C->>FL: log(level, msg, stack?)
FL->>FL: check configured level
alt below threshold
FL-->>C: return
else above threshold
FL->>FL: createLog(level, msg, stack)
FL->>ML: method.call(logger, log)
ML-->>FL: void
end
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
level |
LogLevel
|
The log level to use for this message. |
|
msg |
StringLike
|
Error
|
The message or error to log. |
|
stack |
string
|
<optional> |
Optional stack trace string for errors. |
void