az-bunyan0.2.0-alpha.2 • Public • Published
az-bunyan provides azure storage streams for bunyan logger.
npm install az-bunyan --save
Table storage stream
- Create the stream
// define the target azure storage table nameconst tableName = 'destinationTableName';// define the connection string to your azure storage accountconst connectionString = 'DefaultEndpointsProtocol=https;AccountName=storageAccountName;AccountKey=storageAccoutnKey;'// initialize the az-bunyan table storage streamconst azureStream = azBunyan;
- Add the stream to your bunyan logger
const logger = bunyan;
Custom partitionKey and rowKey
PartitionKey and rowKey are very important concepts of azure storage. Planning your your key strategy is very important to ensure queryability and scalability of your logs. We suggest that you read this documentation.
Az-bunyan comes with a default rowKey and partitionKey strategy, but we don't believe in the one size fits all when it comes to that kind of point. So when you create your stream you can give custom key generation templates.
The templates are compiled with handlerbars so you should follow handlebars syntax.
const azureStream = azBunyan;
- Since azure table only supports column names composed of alpha numeric characters, az-bunyan drops those characters from property names. You should avoid logging an object with property names which differ only by special characters.
- Blob Storage support
- Log rotation support
Feel free to suggest features or submit pull requests.