Skip to content

Commit

Permalink
Finished writing the tutorial section of the docs. Need to write the …
Browse files Browse the repository at this point in the history
…Reference Manual and the Configuration docs.
  • Loading branch information
Andrew Stacy committed Aug 22, 2024
1 parent f0e4cf1 commit c852a82
Show file tree
Hide file tree
Showing 455 changed files with 42,238 additions and 4,031 deletions.
88 changes: 44 additions & 44 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,47 +33,47 @@ jobs:
run: yarn install --force
- name: Run Unit Tests
run: yarn test
release:
name: Release
needs: [lint, test]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 12
- name: Yarn Cache
uses: c-hive/gha-yarn-cache@v1
- name: Install Dependencies
run: yarn install --force
- name: Build
run: yarn build
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
docs:
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup Node.js
uses: actions/setup-node@v1
- name: Yarn Cache
uses: c-hive/gha-yarn-cache@v1
- name: Install Dependencies
run: yarn install --force
- name: Build Content
run: yarn docs:build
- name: Publish
uses: tsunematsu21/[email protected]
with:
dir: docs/.vuepress/dist
branch: gh-pages
token: ${{ secrets.PAGES_TOKEN }}
# release:
# name: Release
# needs: [lint, test]
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v2
# with:
# fetch-depth: 0
# - name: Setup Node.js
# uses: actions/setup-node@v1
# with:
# node-version: 12
# - name: Yarn Cache
# uses: c-hive/gha-yarn-cache@v1
# - name: Install Dependencies
# run: yarn install --force
# - name: Build
# run: yarn build
# - name: Release
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
# run: npx semantic-release
# docs:
# runs-on: ubuntu-latest
# needs: [lint, test]
# steps:
# - name: Checkout
# uses: actions/checkout@v1
# - name: Setup Node.js
# uses: actions/setup-node@v1
# - name: Yarn Cache
# uses: c-hive/gha-yarn-cache@v1
# - name: Install Dependencies
# run: yarn install --force
# - name: Build Content
# run: yarn docs:build
# - name: Publish
# uses: tsunematsu21/[email protected]
# with:
# dir: docs/.vuepress/dist
# branch: gh-pages
# token: ${{ secrets.PAGES_TOKEN }}
44 changes: 44 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# name: Deploy Docs

# on:
# push:
# branches:
# # make sure this is the branch you are using
# - main

# permissions:
# contents: write

# jobs:
# deploy-gh-pages:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# with:
# fetch-depth: 0
# # if your docs needs submodules, uncomment the following line
# # submodules: true

# - name: Setup Node.js
# uses: actions/setup-node@v3
# with:
# node-version: 20
# cache: npm

# - name: Install Deps
# run: npm ci

# - name: Build Docs
# env:
# NODE_OPTIONS: --max_old_space_size=8192
# run: |-
# npm run docs:build
# > docs/.vuepress/dist/.nojekyll

# - name: Deploy Docs
# uses: JamesIves/github-pages-deploy-action@v4
# with:
# # This is the branch where the docs are deployed to
# branch: gh-pages
# folder: docs/.vuepress/dist
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
56 changes: 56 additions & 0 deletions docs-old/addons/creating-addons.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Creating Add-on's

One of the core tenets of Adze is to **not do too much**. This means that the core functionality of Adze is to provide the user with the ability to have control over their logs, how they are shaped, and to be able to listen to their logs and do with the log data as they please. Anything resembling transporting log data to files, API's, or databases is purposefully omitted from the core. However, because of Adze [log listeners](../guide/globalstore-concepts.md#listeners), there is opportunity for add-on packages to provide simple solutions for handling log data transports and various other solutions.

## Best Practices

When creating add-on's for Adze your primary interface should be wrapping a [log listener](../guide/globalstore-concepts.md#listeners). By wrapping a log listener you can intercept the [log data](../guide/data.md#label-data-object) and [log render](../guide/data.md#log-render) and act upon it. To do this, your add-on should export a function that takes a callback function as a parameter and then executes that callback function at a later time and forwards the **log data** and **log render** to it as parameters. Let's take a look at an example.

## Add-on Example

Let's first create our wrapper function that our add-on will expose.

#### my-addon.js

```javascript
// We'll create an exported function that takes a callback as a parameter
// and sets a default to an empty anonymous function.
export function MyAddon(cb = () => {}) {
// Our wrapper will return a log listener callback function that
// accepts log data and a log render.
return (data, render) => {
// Do stuff with the log data and log render

// Then make sure to execute the user specified callback before finishing.
cb(data, render);
};
}
```

#### my-app.js

```javascript
import { adze, createGlobalStore } from 'adze';

// Now, in our app, we'll import the wrapper function we created above.
import { MyAddon } from './my-addon.js';

const globalStore = createGlobalStore();

// Now, to use the add-on, I'll wrap my log listener callback function with
// the MyAddon wrapper. We'll target all logs to use this add-on.
globalStore.addListener(
'*',
MyAddon((data, render) => {
// Do normal log listener stuff here...
})
);

// Or alternatively, since we specified an empty anonymous function
// as the default parameter of our add-on, we can call it empty.
globalStore.addListener('*', MyAddon());

adze().log('This log will be intercepted by our add-on!');
```

Following the pattern above allows your add-on to operate on log data and log renders while also giving control to the end-user over which logs it wants your add-on to target.
27 changes: 27 additions & 0 deletions docs-old/addons/official-addons.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Official Add-on's

The following list contains add-on's that are officially supported by core Adze contributors and are maintained under the [`@adze` npm organization namespace](). We hope that over time this list will grow and hopefully community created add-on's can be adopted by the official organization.

---

## @adze/security-validator

This project is a plugin for the Adze logging library to provide tools for ensuring proper context is applied to logs that are meant to record security events such as access events and authentication events.

This library exposes some opinionated interfaces and a log listener factory for validating your security event logs.

| | Location |
| ----------- | ---------------------------------------------------------------------------------------------------------------- |
| Source Code | [https://github.com/AJStacy/adze-security-validator](https://github.com/AJStacy/adze-security-validator) |
| npm | [https://www.npmjs.com/package/@adze/security-validator](https://www.npmjs.com/package/@adze/security-validator) |

## @adze/transport-cloudwatch-logs

This project is a plugin for the Adze logging library to transport log data to AWS CloudWatch Logs.

This library exposes a log listener factory for setting up log groups and streams in CloudWatch Logs. It can be configured to automatically create the group or stream if it does not already exist.

| | Location |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------ |
| Source Code | [https://github.com/AJStacy/adze-transport-cloudwatch-logs](https://github.com/AJStacy/adze-transport-cloudwatch-logs) |
| npm | [https://www.npmjs.com/package/@adze/transport-cloudwatch-logs](https://www.npmjs.com/package/@adze/transport-cloudwatch-logs) |
Loading

0 comments on commit c852a82

Please sign in to comment.