Skip to content

Commit 5d4a819

Browse files
committed
Initial commit
1 parent d70c04b commit 5d4a819

18 files changed

+558
-1
lines changed

Diff for: .github/ISSUE_TEMPLATE/bug_report.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: Bug report 🐞
3+
about: Create a report to help us improve
4+
labels: bug
5+
---
6+
7+
## Describe the bug
8+
A clear and concise description of what the bug is.
9+
10+
## To Reproduce
11+
Steps to reproduce the behavior e.g. provide example action definition.
12+
13+
## Expected behavior
14+
A clear and concise description of what you expected to happen.
15+
16+
## Additional context
17+
Add any other context about the problem here.

Diff for: .github/ISSUE_TEMPLATE/feature_request.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: Feature Request 💡
3+
about: Suggest a new idea for the project.
4+
labels: enhancement
5+
---
6+
7+
# Summary
8+
9+
Brief explanation of the feature.
10+
11+
## Basic example
12+
13+
If the proposal involves a new or changed API, include a basic code example. Omit this section if it's not applicable.
14+
15+
## Motivation
16+
17+
Why are we doing this? What use cases does it support? What is the expected outcome?

Diff for: .github/ISSUE_TEMPLATE/question.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
name: Question ❓
3+
about: Is something unclear?
4+
labels: question
5+
---
6+
7+
# Question?

Diff for: .github/dependabot.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
version: 2
3+
updates:
4+
- package-ecosystem: "gomod"
5+
directory: "/"
6+
schedule:
7+
interval: "daily"
8+
open-pull-requests-limit: 10
9+
- package-ecosystem: "github-actions"
10+
directory: "/"
11+
schedule:
12+
interval: "daily"
13+
open-pull-requests-limit: 10

Diff for: .github/pull_request_template.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Proposed Changes
2+
3+
-
4+
-
5+
-
6+
7+
Fixes #

Diff for: .github/release-drafter.yml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name-template: 'v$RESOLVED_VERSION'
2+
tag-template: 'v$RESOLVED_VERSION'
3+
categories:
4+
- title: '⚠️ Breaking'
5+
labels:
6+
- 'breaking'
7+
- title: '🚀 Features'
8+
labels:
9+
- 'feature'
10+
- 'enhancement'
11+
- title: '🐛 Bug Fixes'
12+
labels:
13+
- 'fix'
14+
- 'bugfix'
15+
- 'bug'
16+
- title: '🧰 Maintenance'
17+
labels:
18+
- 'chore'
19+
- 'dependencies'
20+
- 'documentation'
21+
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
22+
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
23+
version-resolver:
24+
major:
25+
labels:
26+
- 'major'
27+
minor:
28+
labels:
29+
- 'minor'
30+
patch:
31+
labels:
32+
- 'patch'
33+
default: patch
34+
exclude-labels:
35+
- 'skip-changelog'
36+
autolabeler:
37+
- label: 'documentation'
38+
files:
39+
- '*.md'
40+
branch:
41+
- '/docs{0,1}\/.+/'
42+
- label: 'bug'
43+
branch:
44+
- '/fix\/.+/'
45+
title:
46+
- '/fix/i'
47+
- label: 'enhancement'
48+
branch:
49+
- '/feature\/.+/'
50+
- label: 'enhancement'
51+
branch:
52+
- '/enh\/.+/'
53+
- label: 'chore'
54+
branch:
55+
- '/chore\/.+/'
56+
template: |
57+
## Changes
58+
$CHANGES

Diff for: .github/workflows/clean-cache.yaml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Cleanup caches
2+
on:
3+
pull_request:
4+
types:
5+
- closed
6+
7+
jobs:
8+
cleanup:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Check out code
12+
uses: actions/checkout@v4
13+
14+
- name: Cleanup
15+
run: |
16+
gh extension install actions/gh-actions-cache
17+
18+
REPO=${{ github.repository }}
19+
BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge"
20+
21+
echo "Fetching list of cache key"
22+
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 )
23+
24+
## Setting this to not fail the workflow while deleting cache keys.
25+
set +e
26+
echo "Deleting caches..."
27+
for cacheKey in $cacheKeysForPR
28+
do
29+
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
30+
done
31+
echo "Done"
32+
env:
33+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Diff for: .github/workflows/lint.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Lint
2+
3+
on:
4+
pull_request:
5+
paths-ignore:
6+
- 'docs/**'
7+
- '**/*.md'
8+
jobs:
9+
golangci:
10+
name: lint
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-go@v4
15+
with:
16+
go-version-file: 'go.mod'
17+
- name: golangci-lint
18+
uses: golangci/golangci-lint-action@v3
19+
with:
20+
version: v1.54.2

Diff for: .github/workflows/release-drafter.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Release Drafter
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request_target:
8+
types: [ opened, reopened, synchronize ]
9+
10+
jobs:
11+
update_release_draft:
12+
runs-on: ubuntu-latest
13+
steps:
14+
# Drafts your next Release notes as Pull Requests are merged into "main"
15+
- uses: release-drafter/release-drafter@v5
16+
with:
17+
disable-releaser: github.ref != 'refs/heads/main'
18+
config-name: release-drafter.yml
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Diff for: .github/workflows/size-label.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Size Label
2+
3+
on:
4+
pull_request_target:
5+
types: [ assigned, opened, synchronize, reopened ]
6+
7+
jobs:
8+
size-label:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: size-label
12+
uses: pascalgn/[email protected]
13+
env:
14+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

Diff for: .github/workflows/test.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Pull Request Code test
2+
3+
on:
4+
pull_request:
5+
types: [ assigned, opened, synchronize, reopened ]
6+
paths-ignore:
7+
- 'docs/**'
8+
- '**/*.md'
9+
10+
jobs:
11+
checks:
12+
name: test
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-go@v4
17+
with:
18+
go-version-file: 'go.mod'
19+
- run: make test

Diff for: .gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@
1919

2020
# Go workspace file
2121
go.work
22+
23+
bin/
24+
.idea/

Diff for: Makefile

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
2+
ifeq (,$(shell go env GOBIN))
3+
GOBIN=$(shell go env GOPATH)/bin
4+
else
5+
GOBIN=$(shell go env GOBIN)
6+
endif
7+
8+
# Setting SHELL to bash allows bash commands to be executed by recipes.
9+
# Options are set to exit when a recipe line exits non-zero or a piped command fails.
10+
SHELL = /usr/bin/env bash -o pipefail
11+
.SHELLFLAGS = -ec
12+
13+
.PHONY: all
14+
all: build
15+
16+
##@ General
17+
18+
# The help target prints out all targets with their descriptions organized
19+
# beneath their categories. The categories are represented by '##@' and the
20+
# target descriptions by '##'. The awk commands is responsible for reading the
21+
# entire set of makefiles included in this invocation, looking for lines of the
22+
# file as xyz: ## something, and then pretty-format the target and help. Then,
23+
# if there's a line with ##@ something, that gets pretty-printed as a category.
24+
# More info on the usage of ANSI control characters for terminal formatting:
25+
# https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters
26+
# More info on the awk command:
27+
# http://linuxcommand.org/lc3_adv_awk.php
28+
29+
.PHONY: help
30+
help: ## Display this help.
31+
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
32+
33+
##@ Development
34+
35+
.PHONY: fmt
36+
fmt: ## Run go fmt against code.
37+
go fmt ./...
38+
39+
.PHONY: vet
40+
vet: ## Run go vet against code.
41+
go vet ./...
42+
43+
.PHONY: test
44+
test: fmt vet check-license ## Run tests.
45+
go test ./... -coverprofile cover.out
46+
47+
.PHONY: add-license
48+
add-license: addlicense ## Add license headers to all go files.
49+
find . -name '*.go' -exec $(ADDLICENSE) -c 'Andreas Fritzler' {} +
50+
51+
.PHONY: check-license
52+
check-license: addlicense ## Check that every file has a license header present.
53+
find . -name '*.go' -exec $(ADDLICENSE) -c 'Andreas Fritzler' {} +
54+
55+
lint: ## Run golangci-lint against code.
56+
golangci-lint run ./...
57+
58+
check: add-license lint test
59+
60+
##@ Build Dependencies
61+
62+
## Location to install dependencies to
63+
LOCALBIN ?= $(shell pwd)/bin
64+
$(LOCALBIN):
65+
mkdir -p $(LOCALBIN)
66+
67+
## Tool Binaries
68+
ADDLICENSE ?= $(LOCALBIN)/addlicense
69+
70+
## Tool Versions
71+
ADDLICENSE_VERSION ?= v1.1.1
72+
73+
.PHONY: addlicense
74+
addlicense: $(ADDLICENSE) ## Download addlicense locally if necessary.
75+
$(ADDLICENSE): $(LOCALBIN)
76+
test -s $(LOCALBIN)/addlicense || GOBIN=$(LOCALBIN) go install github.com/google/addlicense@$(ADDLICENSE_VERSION)

Diff for: README.md

+73-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,73 @@
1-
# streetlogr
1+
# StreetLogr
2+
3+
StreetLogr is a slick, urban-themed logging interface built around Go's `logr` interface.
4+
5+
## 🚀 Features
6+
7+
- **🗣️ Word**: Drop informational messages in style.
8+
- **👀 Sus**: Log errors when things look suspicious.
9+
- **🔍 Peep**: Adjust verbosity levels to peep more details.
10+
- **🌟 Swag**: Add some swag to your logs with key-value pairs.
11+
- **🏷️ Handle**: Tag your logger with a unique name.
12+
13+
## 🛠 Installation
14+
15+
Install StreetLogr using `go get`:
16+
17+
```sh
18+
go get github.com/afritzler/streetlogr
19+
```
20+
21+
## Usage
22+
23+
Here's a quick start guide to using StreetLogr:
24+
25+
```go
26+
package main
27+
28+
import (
29+
"errors"
30+
"github.com/go-logr/zapr"
31+
"go.uber.org/zap"
32+
"github.com/afritzler/streetlogr"
33+
)
34+
35+
func main() {
36+
// Instantiate a zap logger
37+
zapLogger, _ := zap.NewDevelopment()
38+
39+
// Wrap it with zapr to get a logr.Logger
40+
logrLogger := zapr.NewLogger(zapLogger)
41+
42+
// Instantiate StreetLogr
43+
logger := streetlogr.StreetLogr{logrLogger}
44+
45+
// Use the logger
46+
logger.Word("The buzz in the street", "key1", "value1")
47+
48+
err := errors.New("some creepy error")
49+
logger.Sus(err, "It's looking sus!", "key1", "value1")
50+
}
51+
```
52+
53+
A more extensible example can be found in the [example](/example) folder.
54+
55+
## 🤝 Contributing
56+
57+
Contributions are what make the open-source community an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
58+
59+
1. Fork the Project
60+
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
61+
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
62+
4. Push to the Branch (`git push origin feature/AmazingFeature`)
63+
5. Open a Pull Request
64+
65+
## 📄 License
66+
67+
Distributed under the Apache 2.0 License. See [LICENSE.md](LICENSE) for more information.
68+
69+
## 📣 Acknowledgements
70+
71+
* Go `logr`
72+
* Uber's `zap`
73+
* The incredible Go community

0 commit comments

Comments
 (0)