Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@bitdiver/logadapter
Advanced tools
@bitdiver/logadapter / Exports
The log adapter is used to handle the log calls. All the log events from the steps or the runner will be forwarded to the registered log adapter.
This logger just logs to the console output. It implements the main logic other log adapter may need.
This LogAdapter is intended to be used as a base class for other adapters.
configuration
const opts = {
logLevel: 'error'
timeFormat: 'yyyy-MM-dd HH:mm:ss.SSS ZZ'
}
The logLevel of the logger. Default is ''error''.
The time format used to display times in the log. The format comes from 'https://moment.github.io/luxon/' module.
logAdapter.log(logMessage) : promise
Format of the logMessage
const logMessage = {
meta: {
run: {
start: new Date(),
id: 'runId',
name: 'suite name',
},
tc: {
countCurrent: tcCountCurrent,
countAll: tcCountAll,
id: 'tcId',
name: 'great tc name',
},
step: {
countCurrent: stepCountCurrent,
countAll: stepCountAll,
id: 'stepId',
name: 'great step name',
typ: 'singel',
},
},
data: { anyKey: 'some value' },
logLevel: 'error',
}
The 'run' section of the meta block is always there. No log without a run. This is filled automatically.
If the log comes from a test case or a step also the 'tc' section is provided. This is filled automatically.
The 'step' section is only provided if the log was initiated by a step. This is filled automatically.
The 'data' section contains the real message data.
The logLevel is also set automatically.
This is a special implementation of a LogAdapter. Its mainly used for testing. If there is a unit test for a step this adapter could be used to collect the created logs to validate them
Format the data is stored
const this.logs = {
runId: {
logs:[{}, ...]
testcases: {}
}
}
The data is stored under the property 'logs' of the LogAdapter.
The data is stored per run by the run Id. Normally there will be only one run at a time.
This log stores all the logs directly related to the run.
Logs which are related to a test case are stored by the test case instance id under this property.
Format of the test case section
const testcase = {
logs: []
steps: {}
}
This log stores all the logs directly related to the test case.
Logs which are related to a step are stored by the step instance id under this property.
Format of the step section
const step = {
logs: []
}
Stores the logs into a local file system. It will create one directory per run. Then in the run directory one directory per test case. And again in the test case one directory per step.
configuration
const opts = {
targetDir: 'logs'
timeFormatFileName: 'yyyy-MM-dd_HHmmss'
}
The constructor arguments are the 'targetDir'. All the logs will be stored under this directory. This parameter defaults to ''log''
The format used to create the file names.
FAQs
@bitdiver/logadapter / [Exports](docApi/modules.md)
We found that @bitdiver/logadapter demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.