
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
@janiscommerce/log
Advanced tools
A package for creating logs in Firehose
npm install @janiscommerce/log
JANIS_SERVICE_NAME
(required): The name of the service that will create the log.
JANIS_ENV
(required): The name stage that will used as suffix for janis-trace-service bucket.
add(clientCode, log)
Parameters: clientCode [String]
, log [Object]
Puts the recieved log into the janis-trace-firehose
The log [Object]
parameter have the following structure:
id [String]
(optional): The ID of the log in UUID V4 format. Default will be auto-generated.service [String]
(optional): The service name, if this field not exists, will be obtained from the ENV (JANIS_SERVICE_NAME
)type [String]
(required): The log typeentity [String]
(required): The name of the entity that is creating the logentityId [String]
(optional): The ID of the entity that is creating the logmessage [String]
(optional): A general message about the loglog [Object|Array]
(optional): This property is a JSON that includes all the technical data about your log.{
id: '0acefd5e-cb90-4531-b27a-e4d236f07539',
type: 'new',
entity: 'api',
entity_id: 'log',
service: 'trace',
message: '[GET] Request from 12.345.67.89 to /log',
date_created: 1559103066,
log: {
verb: 'GET',
headers: {
'x-forwarded-for': '12.345.67.89',
'x-forwarded-proto': 'https',
'x-forwarded-port': '443'
},
responseHttpCode: 200
}
}
on(event, callback)
Parameters: event [String]
, callback [Function]
Calls a callback when the specified event is emitted.
The errors are informed with a LogError
.
This object has a code that can be useful for a correct error handling.
The codes are the following:
Code | Description |
---|---|
1 | Invalid log |
2 | Firehose Error |
3 | Unknown stage name |
In case of error while creating your log into S3, this package will emit an event called create-error
, you can handle it using the on()
method.
const Log = require('@janiscommerce/log');
Log.add('some-client', {
type: 1,
entity: 'api',
entityId: 'product',
message: '[GET] Request from 0.0.0.0 of custom_data'
// ...
});
Log.on('create-error', (log, err) => {
console.error(`An error occurred while creating the log ${err.message}`);
});
[3.0.0] - 2020-01-14
type
field now can be only a string, not a numberFAQs
A package for creating logs in Janis Trace Service
The npm package @janiscommerce/log receives a total of 262 weekly downloads. As such, @janiscommerce/log popularity was classified as not popular.
We found that @janiscommerce/log 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
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.