internal: remove hlog
All checks were successful
Test / Create distribution (push) Successful in 1m11s
Test / Sandbox (push) Successful in 2m37s
Test / Hpkg (push) Successful in 4m41s
Test / Sandbox (race detector) (push) Successful in 4m53s
Test / Hakurei (race detector) (push) Successful in 5m53s
Test / Hakurei (push) Successful in 2m44s
Test / Flake checks (push) Successful in 1m48s

This package has been fully replaced by container.Msg.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
Ophestra 2025-09-29 06:21:04 +09:00
parent 46cd3a28c8
commit dc467493d8
Signed by: cat
SSH Key Fingerprint: SHA256:gQ67O0enBZ7UdZypgtspB2FDM1g3GVw8nX0XSdcFw8Q
3 changed files with 0 additions and 67 deletions

View File

@ -1,34 +0,0 @@
// Package hlog provides various functions for output messages.
package hlog
import (
"log"
"os"
"hakurei.app/container"
)
var o = &container.Suspendable{Downstream: os.Stderr}
// Prepare configures the system logger for [Suspend] and [Resume] to take effect.
func Prepare(prefix string) { log.SetPrefix(prefix + ": "); log.SetFlags(0); log.SetOutput(o) }
func Suspend() bool { return o.Suspend() }
func Resume() bool {
resumed, dropped, _, err := o.Resume()
if err != nil {
// probably going to result in an error as well,
// so this call is as good as unreachable
log.Printf("cannot dump buffer on resume: %v", err)
}
if resumed && dropped > 0 {
log.Fatalf("dropped %d bytes while output is suspended", dropped)
}
return resumed
}
func BeforeExit() {
if Resume() {
log.Printf("beforeExit reached on suspended output")
}
}

View File

@ -1,10 +0,0 @@
package hlog
type Output struct{}
func (Output) IsVerbose() bool { return Load() }
func (Output) Verbose(v ...any) { Verbose(v...) }
func (Output) Verbosef(format string, v ...any) { Verbosef(format, v...) }
func (Output) Suspend() { Suspend() }
func (Output) Resume() bool { return Resume() }
func (Output) BeforeExit() { BeforeExit() }

View File

@ -1,23 +0,0 @@
package hlog
import (
"log"
"sync/atomic"
)
var verbose = new(atomic.Bool)
func Load() bool { return verbose.Load() }
func Store(v bool) { verbose.Store(v) }
func Verbosef(format string, v ...any) {
if verbose.Load() {
log.Printf(format, v...)
}
}
func Verbose(v ...any) {
if verbose.Load() {
log.Println(v...)
}
}