Skip to content

Commit

Permalink
Merge pull request #66 from KyleRoss/v3.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleRoss committed Oct 14, 2021
2 parents a051e03 + 18ed8a2 commit a70d8ca
Show file tree
Hide file tree
Showing 130 changed files with 19,527 additions and 64,494 deletions.
2 changes: 1 addition & 1 deletion .codeclimate.yml
Expand Up @@ -36,7 +36,7 @@ checks:
enabled: true
identical-code:
enabled: true
plugins:
plugins:
eslint:
enabled: true
channel: "eslint-7"
Expand Down
8 changes: 6 additions & 2 deletions .eslintrc.yml
Expand Up @@ -12,18 +12,22 @@ env:
plugins:
- 'jsdoc'
- 'node'

extends:
- 'xo-space/esnext'
- 'xo-space'
- 'plugin:jsdoc/recommended'
- 'plugin:node/recommended'

rules:
array-element-newline: off
capitalized-comments: off
curly: ['error', 'multi-line']
comma-dangle: ['error', 'never']
object-curly-spacing: ['error', 'always']
operator-linebreak: ['error', 'after']
no-multiple-empty-lines: ['error', { max: 2, maxEOF: 1, maxBOF: 0 }]
no-negated-condition: off
keyword-spacing: ['error', { overrides: { if: { after: false }, for: { after: false }, while: { after: false }, catch: { after: false } } }]
jsdoc/newline-after-description: off
node/no-unsupported-features/es-syntax: ['error', { version: '>=10.0.0' }]
node/no-missing-require: off
16 changes: 11 additions & 5 deletions .github/workflows/module.yml
Expand Up @@ -11,7 +11,7 @@ jobs:
test:
strategy:
matrix:
node: [ '10', '12', '14' ]
node: [ '10', '12', '14', '16' ]
name: test/node v${{ matrix.node }}
runs-on: ubuntu-latest
steps:
Expand All @@ -22,7 +22,7 @@ jobs:
with:
node-version: ${{ matrix.node }}
- name: Install Dependencies
run: npm ci
run: npm i
- name: Run Tests
run: npm test

Expand All @@ -38,7 +38,7 @@ jobs:
with:
node-version: 14
- name: Install Dependencies
run: npm ci
run: npm i
- name: Run Tests
if: ${{ github.event_name == 'pull_request' }}
run: npm test
Expand Down Expand Up @@ -70,7 +70,13 @@ jobs:
with:
node-version: 14
- name: Install Dependencies
run: npm ci
run: npm i
- name: Delete expired artifacts
uses: LKP-RnD/purge-expired-artifacts-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
repo_to_purge: "KyleRoss/node-lambda-log"
dry_run: "false"
- uses: bradennapier/eslint-plus-action@v3.4.2
with:
includeGlob: 'index.js,index.test.js,lib/*.js'
Expand All @@ -88,7 +94,7 @@ jobs:
with:
node-version: 14
- name: Install Dependencies
run: npm ci
run: npm i
- name: Publish to NPM
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/site.yml
Expand Up @@ -12,10 +12,10 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@master
- name: Build and Deploy Site
uses: srepollock/gatsby-gh-pages-action@v2.2.0
- name: Deploy Site
uses: peaceiris/actions-gh-pages@v3
with:
access-token: ${{ secrets.ACCESS_TOKEN }}
deploy-branch: gh-pages
gatsby-args: --prefix-paths
working-dir: ${{ github.workspace }}/site
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: ./gh-pages
cname: lambdalog.js.org
15 changes: 0 additions & 15 deletions .gitignore
Expand Up @@ -5,15 +5,6 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

Expand All @@ -26,12 +17,6 @@ node_modules/
# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

Expand Down
5 changes: 5 additions & 0 deletions .npmignore
@@ -1,10 +1,15 @@
.github
.husky
.vscode
gh-pages
site
.eslintrc.yml
.releaserc
commitlint.config.js
*.test.js
jest.config.js
.all-contributorsrc
.codeclimate.yml
babel.config.js
CHANGELOG.md
README.md
5 changes: 4 additions & 1 deletion .vscode/settings.json
Expand Up @@ -14,5 +14,8 @@
"directory": "site",
"changeProcessCWD": true
}
]
],
"[mdx]": {
"editor.wordWrap": "on"
}
}
19 changes: 10 additions & 9 deletions README.md
@@ -1,16 +1,17 @@
# lambda-log

[![npm](https://img.shields.io/npm/v/lambda-log.svg?style=for-the-badge)](https://www.npmjs.com/package/lambda-log) [![npm](https://img.shields.io/npm/dt/lambda-log.svg?style=for-the-badge)](https://www.npmjs.com/package/lambda-log) [![David](https://img.shields.io/david/KyleRoss/node-lambda-log.svg?style=for-the-badge)](https://david-dm.org/KyleRoss/node-lambda-log) ![GitHub Workflow Status](https://img.shields.io/github/workflow/status/KyleRoss/node-lambda-log/module?style=for-the-badge) [![Code Climate coverage](https://img.shields.io/codeclimate/coverage/KyleRoss/node-lambda-log?style=for-the-badge)](https://codeclimate.com/github/KyleRoss/node-lambda-log) [![license](https://img.shields.io/github/license/KyleRoss/node-lambda-log.svg?style=for-the-badge)](https://github.com/KyleRoss/node-lambda-log/blob/master/LICENSE) [![Code Climate maintainability](https://img.shields.io/codeclimate/maintainability/KyleRoss/node-lambda-log?style=for-the-badge)](https://codeclimate.com/github/KyleRoss/node-lambda-log) [![CodeFactor Grade](https://img.shields.io/codefactor/grade/github/KyleRoss/node-lambda-log?style=for-the-badge)](https://www.codefactor.io/repository/github/kyleross/node-lambda-log) [![Snyk Vulnerabilities for npm package](https://img.shields.io/snyk/vulnerabilities/npm/lambda-log?style=for-the-badge)](https://snyk.io/advisor/npm-package/lambda-log)
[![npm](https://img.shields.io/npm/v/lambda-log.svg?style=for-the-badge)](https://www.npmjs.com/package/lambda-log) [![npm](https://img.shields.io/npm/dt/lambda-log.svg?style=for-the-badge)](https://www.npmjs.com/package/lambda-log) ![GitHub Workflow Status](https://img.shields.io/github/workflow/status/KyleRoss/node-lambda-log/module?style=for-the-badge) [![Code Climate coverage](https://img.shields.io/codeclimate/coverage/KyleRoss/node-lambda-log?style=for-the-badge)](https://codeclimate.com/github/KyleRoss/node-lambda-log) [![license](https://img.shields.io/github/license/KyleRoss/node-lambda-log.svg?style=for-the-badge)](https://github.com/KyleRoss/node-lambda-log/blob/master/LICENSE) [![Code Climate maintainability](https://img.shields.io/codeclimate/maintainability/KyleRoss/node-lambda-log?style=for-the-badge)](https://codeclimate.com/github/KyleRoss/node-lambda-log) [![CodeFactor Grade](https://img.shields.io/codefactor/grade/github/KyleRoss/node-lambda-log?style=for-the-badge)](https://www.codefactor.io/repository/github/kyleross/node-lambda-log) [![Snyk Vulnerabilities for npm package](https://img.shields.io/snyk/vulnerabilities/npm/lambda-log?style=for-the-badge)](https://snyk.io/advisor/npm-package/lambda-log)
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-10-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

A [Node.js package](https://www.npmjs.com/package/lambda-log) to facilitate and enforce logging standards from processes and applications running within Lambda Functions, various AWS Services, and wherever JSON logs are desired. Lambda Log formats your log messages as JSON for simple parsing and filtering within tools such as CloudWatch Logs. Supports **Node 10+**.
LambdaLog is a [Node.js package](https://www.npmjs.com/package/lambda-log) facilitates and enforces logging standards in Node.js processes or applications **anywhere** by formatting your log messages as JSON for simple parsing and filtering within log management tools, such as CloudWatch Logs. _Works with all of the supported versions of Node.js on Lambda._

Originally created for AWS Lambda Functions, LambdaLog is a lightweight and feature-rich library that has **no** dependency on AWS or Lambda, meaning you can use it in any type of Node.js project you wish. **It's really a universal JSON logger.**

> This module is not just for Lambda! You can use this is many different environments that support reading JSON from logs. While the name remains `lambda-log`, it's really a universal JSON logger.

**Why another lambda logger?**
There are others out there, but seemed to be convoluted, included more functionality than needed, not maintained, or not configurable enough. I created lambda-log to include the important functionality from other loggers, but still keeping it simple with minimal dependencies.
There are plenty of other logging libraries in the NPM ecosystem but most are convoluted, included more functionality than needed, not maintained, or are not configurable enough. I created LambdaLog to include the important functionality from other loggers, but still maintaining simplicity with minimal dependencies.

### Features

Expand All @@ -22,12 +23,12 @@ Anyone can log JSON to the `console`, but with Lambda Log you also get:
- Pluggable and customizable by extending the LambdaLog class.
- Pretty-printing of the JSON log message in dev mode.
- Well documented, commented, and maintained source code.
- Over 1 million downloads and more than 20k weekly downloads.
- Over 1.5 million downloads and more than 35k weekly downloads.
- Small footprint.

#### New in Version 3.0.0

Version 3.0.0 of Lambda Log brings a bunch of changes, new features, and a [new website](https://lambdalog.js.org).
Version 3.0.0 of Lambda Log brings a bunch of changes, new features, and a [new website](https://lambdalog.dev).

**Broad Changes:**

Expand Down Expand Up @@ -58,19 +59,19 @@ Version 3.0.0 of Lambda Log brings a bunch of changes, new features, and a [new

## Documentation

Documentation for Lambda Log has moved to our [new website](https://lambdalog.js.org).
Documentation for Lambda Log has moved to our [new website](https://lambdalog.dev).



## Tests

See [Development Documentation](https://lambdalog.js.org/docs/development).
See [Development Documentation](https://lambdalog.dev/docs/latest/development).



## Contributing

See [Contributing Documentation](https://lambdalog.js.org/docs/contributing).
See [Contributing Documentation](https://lambdalog.dev/docs/latest/contributing).



Expand Down
6 changes: 6 additions & 0 deletions babel.config.js
@@ -0,0 +1,6 @@
module.exports = {
babelrcRoots: [
'.',
'site/*'
]
};
7 changes: 6 additions & 1 deletion commitlint.config.js
@@ -1 +1,6 @@
module.exports = { extends: ['@commitlint/config-conventional'] };
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'body-max-line-length': [0]
}
};
10 changes: 10 additions & 0 deletions gh-pages/index.html
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Redirecting to https://lambdalog.dev</title>
<meta http-equiv="refresh" content="0; URL=https://lambdalog.dev/">
<link rel="canonical" href="https://lambdalog.dev/">
</head>
<body></body>
</html>
7 changes: 3 additions & 4 deletions lib/LambdaLog.js
Expand Up @@ -30,7 +30,7 @@ class LambdaLog extends EventEmitter {
* via `log.LambdaLog`.
* @class
* @param {LambdaLogOptions} [options={}] Options for configuring LambdaLog.
* @param {object.<string, string|Function>} [levels={}] Allows adding and customizing log levels.
* @param {object.<string, string|Function>} [levels={}] Allows adding and customizing log levels. DEPRECATED
*/
constructor(options = {}, levels = {}) {
super();
Expand Down Expand Up @@ -98,6 +98,7 @@ class LambdaLog extends EventEmitter {
/**
* Add a new log level to this instance of LambdaLog.
* @since 3.0.0
* @deprecated
* @param {string} name The name of the new log level.
* @param {string|Function} handler The string name of the `console` method to call or a function that returns a string method name.
* @returns {this} Instance of LambdaLog.
Expand All @@ -114,9 +115,7 @@ class LambdaLog extends EventEmitter {
* @param {string[]} [tags=[]] Additional tags to append to this log.
* @returns {LogMessage} The LogMessage instance for the log.
*/
this[name] = (msg, meta = {}, tags = []) => {
return this.log(name, msg, meta, tags);
};
this[name] = (msg, meta = {}, tags = []) => this.log(name, msg, meta, tags);

return this;
}
Expand Down
4 changes: 1 addition & 3 deletions lib/LogMessage.test.js
Expand Up @@ -190,9 +190,7 @@ describe('Getters', () => {
const msg = new LogMessage({ ...logData.withMeta }, {
...defaultOpts,
meta: { foo: 'bar' },
dynamicMeta: () => {
return { dynamic: 'meta' };
}
dynamicMeta: () => ({ dynamic: 'meta' })
});

expect(msg.meta).toHaveProperty('test', true);
Expand Down

1 comment on commit a70d8ca

@vercel
Copy link

@vercel vercel bot commented on a70d8ca Oct 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.