cinovo-logger-aws v0.4.4
___
__ /\_ \
___ /\_\ ___ ___ __ __ ___ \//\ \ ___ __ __ __ _ __
/'___\/\ \ /' _ `\ / __`\/\ \/\ \ / __`\ _______\ \ \ / __`\ /'_ `\ /'_ `\ /'__`\/\`'__\
/\ \__/\ \ \/\ \/\ \/\ \L\ \ \ \_/ |/\ \L\ \/\______\\_\ \_/\ \L\ \/\ \L\ \/\ \L\ \/\ __/\ \ \/
\ \____\\ \_\ \_\ \_\ \____/\ \___/ \ \____/\/______//\____\ \____/\ \____ \ \____ \ \____\\ \_\
\/____/ \/_/\/_/\/_/\/___/ \/__/ \/___/ \/____/\/___/ \/___L\ \/___L\ \/____/ \/_/
/\____/ /\____/
\_/__/ \_/__/
cinovo-logger-aws
AWS S3, SNS or SQS endpoint for cinovo-logger.
Getting started
At first you must install and require the logger.
npm install cinovo-logger
Next you must require the module
var logger = require("cinovo-logger");
Append cinovo-logger-aws endpoint
npm install cinovo-logger-aws
In your JavaScript code append the S3 endpoint.
require("cinovo-logger-aws").s3(true, true, true, true, "./log", "s3_", ".log", 1024 * 1024, 60 * 60, 5, "eu-west-1", "my-bucket-name", "my/folder", undefined, undefined, function(err, endpoint) {
if (err) {
throw err;
} else {
logger.append(endpoint);
}
}
and / or append the SNS endpoint.
logger.append(require("cinovo-logger-aws").sns(true, true, true, true, "eu-west-1", "topicArn"));
and / or append the SQS endpoint.
logger.append(require("cinovo-logger-aws").sqs(true, true, true, true, "eu-west-1", "queueUrl"));
Log something
logger.debug("all values are ok");
logger.info("myscript", "all values are ok");
logger.error("myscript", "some values are not ok", {a: 10, b: 20});
logger.exception("myscript", "some values are not ok", new Error("error"));
logger.critical("myscript", "all values are not ok", {a: 10, b: 20}, function(err) { ... });
Done
Now you can log to AWS S3, SNS or SQS endpoints.
API
sns(debug, info, error, critial, region, topicArn, accessKeyId, secretAccessKey)
Sync creates an SNS endpoint.
debug
: Boolean - true if the endpoint should log debug levelinfo
: Boolean - true if the endpoint should log info levelerror
: Boolean - true if the endpoint should log error levelcritical
: Boolean - true if the endpoint should log critical levelregion
: String - your AWS regiontopicArn
: String - the topic you want to publish toaccessKeyId
: String - your AWS access key ID (optional)secretAccessKey
: String - your AWS secret access key (optional)
return
: Endpoint - use the endpoint like this logger.append(endpoint)
sqs(debug, info, error, critial, region, queueUrl, accessKeyId, secretAccessKey)
Sync creates an SQS endpoint.
debug
: Boolean - true if the endpoint should log debug levelinfo
: Boolean - true if the endpoint should log info levelerror
: Boolean - true if the endpoint should log error levelcritical
: Boolean - true if the endpoint should log critical levelregion
: String - your AWS regionqueueUrl
: String - the URL of the SQS queue to take action onaccessKeyId
: String - your AWS access key ID (optional)secretAccessKey
: String - your AWS secret access key (optional)
return
: Endpoint - use the endpoint like this logger.append(endpoint)
s3(debug, info, error, critial, dir, fileSuffix, filePrefix, maxFileSize, maxFileAge, maxFiles, region, bucket, bucketDir, accessKeyId, secretAccessKey, callback)
Async creates an cinovo-logger-file endpoint to copy log files into S3 on roll or stop.
debug
: Boolean - true if the endpoint should log debug levelinfo
: Boolean - true if the endpoint should log info levelerror
: Boolean - true if the endpoint should log error levelcritical
: Boolean - true if the endpoint should log critical leveldir
: String - directory in which log files are saved.filePrefix
: String -fileSuffix
: String -maxFileSize
: Number - bytesmaxFileAge
: Number - secondsmaxFiles
: Number - Maximum Number of files in dir (oldest are removed first)region
: String - your AWS regionbucket
: String - your AWS bucke namebucketDir
: String or Function - your AWS bucket "directory" (e. g. logs/ or logs/a/b/)accessKeyId
: String - your AWS access key ID (optional)secretAccessKey
: String - your AWS secret access key (optional)callback
: Function(err, endpoint) - fired if the endpoint is ready to useerr
: Error (optional)endpoint
: Endpoint - use the endpoint like this logger.append(endpoint)
s3watcher(endpoint, region, bucket, bucketDir, accessKeyId, secretAccessKey)
Sync takes an cinovo-logger-file endpoint to copy log files into S3 on roll or stop.
endpoint
: FileEndpointregion
: String - your AWS regionbucket
: String - your AWS bucke namebucketDir
: String or Function - your AWS bucket "directory" (e. g. logs/ or logs/a/b/)accessKeyId
: String - your AWS access key ID (optional)secretAccessKey
: String - your AWS secret access key (optional)
Events
error(err)
If the file can not be copied to S3 during roll.
err
: Error
s3Copy(file, etag)
file
: String - name of file that was copied (without path)etag
: String - AWS entity tag for the uploaded object
10 years ago
10 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago