Skip to content

Commit

Permalink
Remove discord functionality, add LogF series of methods, add LogEntr…
Browse files Browse the repository at this point in the history
…yT for programmic logging
  • Loading branch information
Alextopher committed Aug 5, 2023
1 parent 68a8dc4 commit 7a6d02b
Show file tree
Hide file tree
Showing 4 changed files with 151 additions and 238 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Go

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'

- name: Build
run: go build -v ./...

check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'

- name: Verify modfile
run: go mod verify

- name: Vet
run: go vet ./...

- name: Install golint
run: go install golang.org/x/lint/golint@latest

- name: Lint
run: golint -set_exit_status ./...

- name: Check code formatting using gofmt
uses: Jerome1337/[email protected]

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'

- name: Test
run: go test -v ./...
23 changes: 4 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# logging

This module provides thread-safe logging and Discord notifications as a part of our [Mirror](https://github.com/COSI-Lab/Mirror) project.
This module provides thread-safe logging as a part of our [Mirror](https://github.com/COSI-Lab/Mirror) project.

![Screenshot](screenshot.png)

Expand All @@ -22,23 +22,8 @@ import (
)

func main() {
// Optional: If you only want messages to be displayed in the terminal there is no need to run `Setup`
// logging.Setup("https://discord.com/api/webhooks/987654321123456789/S3cR3TwebH00KuRl", "01234567890123456789")

ch := make(chan struct{})

go func() {
// The last argument to all the logging functions is a variadic ...interface{} which is eventually evulated with fmt.Println(...v)
logging.InfoWithAttachment(bytes("Attachment"), "Hello", "World!")
ch <- struct{}{}
}()

go func() {
logging.ErrorToDiscord("This subsystem failed!")
ch <- struct{}{}
}()

<-ch
<-ch
logging.Info("Hello, world!")
logging.Warn("Warning world didn't say hello back!")
logging.Error("Error world is broken!")
}
```
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/COSI-Lab/logging

go 1.18
go 1.20
Loading

0 comments on commit 7a6d02b

Please sign in to comment.