Skip to content

Commit 18657d4

Browse files
Merge pull request #68 from aka-bo/log-wireup
wire-up asherah logger
2 parents c88989f + c441a58 commit 18657d4

File tree

5 files changed

+23
-10
lines changed

5 files changed

+23
-10
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838

3939
steps:
4040
- name: Checkout repository
41-
uses: actions/checkout@v2
41+
uses: actions/checkout@v4
4242

4343
# Initializes the CodeQL tools for scanning.
4444
- name: Initialize CodeQL

.github/workflows/publish.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
timeout-minutes: 15
1010
runs-on: ubuntu-latest
1111
container:
12-
image: golang:1.20.12-bullseye
12+
image: golang:bookworm
1313
options: --ulimit core=-1 --ulimit memlock=-1:-1
1414
steps:
1515
- uses: actions/checkout@v2
@@ -32,11 +32,12 @@ jobs:
3232
timeout-minutes: 15
3333
runs-on: 'macos-latest'
3434
steps:
35-
- uses: actions/checkout@v2
35+
- uses: actions/checkout@v4
3636
- name: Set up Go
37-
uses: actions/setup-go@v2
37+
uses: actions/setup-go@v5
3838
with:
39-
go-version: 1.20.12
39+
go-version: 1.24
40+
check-latest: 'true'
4041
- name: Build for MacOS
4142
run: scripts/macos-build.sh
4243
- name: Publish MacOS sha256sums

.github/workflows/test.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
timeout-minutes: 15
1212
runs-on: ubuntu-latest
1313
container:
14-
image: golang:1.20.12-bullseye
14+
image: golang:bookworm
1515
options: --ulimit core=-1 --ulimit memlock=-1:-1
1616
steps:
1717
- uses: actions/checkout@v2
@@ -28,10 +28,11 @@ jobs:
2828
timeout-minutes: 15
2929
runs-on: 'macos-latest'
3030
steps:
31-
- uses: actions/checkout@v2
31+
- uses: actions/checkout@v4
3232
- name: Set up Go
33-
uses: actions/setup-go@v2
33+
uses: actions/setup-go@v5
3434
with:
35-
go-version: 1.20.12
35+
go-version: 1.24
36+
check-latest: 'true'
3637
- name: Build for MacOS
3738
run: scripts/macos-build.sh

internal/asherah/asherah.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"github.com/godaddy/asherah/go/appencryption"
1212
"github.com/godaddy/asherah/go/appencryption/pkg/crypto/aead"
1313
"github.com/godaddy/asherah/go/appencryption/pkg/kms"
14+
asherahLog "github.com/godaddy/asherah/go/appencryption/pkg/log"
1415
"github.com/godaddy/asherah/go/appencryption/pkg/persistence"
1516
"github.com/godaddy/asherah/go/securememory/memguard"
1617
)
@@ -22,12 +23,22 @@ var ErrAsherahAlreadyInitialized = errors.New("asherah already initialized")
2223
var ErrAsherahNotInitialized = errors.New("asherah not initialized")
2324
var ErrAsherahFailedInitialization = errors.New("asherah failed initialization")
2425

26+
type logFunc func(format string, v ...interface{})
27+
28+
func (f logFunc) Debugf(format string, v ...interface{}) {
29+
f(format, v...)
30+
}
31+
2532
func Setup(options *Options) error {
2633
if atomic.LoadInt32(&globalInitialized) == 1 {
2734
log.ErrorLog("Failed to initialize asherah: already initialized")
2835
return ErrAsherahAlreadyInitialized
2936
}
3037

38+
if options.Verbose && log.DebugLogf != nil {
39+
asherahLog.SetLogger(logFunc(log.DebugLogf))
40+
}
41+
3142
crypto := aead.NewAES256GCM()
3243

3344
if options.SessionCacheMaxSize == 0 {

libasherah_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"github.com/godaddy/cobhan-go"
1111
)
1212

13-
var Verbose = true
13+
var Verbose = false
1414

1515
func setupAsherahForTesting(t *testing.T) {
1616
config := &asherah.Options{}

0 commit comments

Comments
 (0)