added put/get and auth examples to README, added Err(err) debug wrapper

This commit is contained in:
2022-07-08 10:58:42 +02:00
parent d5e5fd3700
commit cddeee1412
10 changed files with 333 additions and 91 deletions

View File

@@ -17,23 +17,23 @@ var messageWriter io.Writer = os.Stdout
var accessWriter io.Writer = os.Stdout
func logDebug(messages ...any) {
stamp := time.Now().Format(time.RFC3339Nano)
fmt.Fprintln(messageWriter, stamp, "debug", messages)
stamp := time.Now().Format(time.RFC3339)
fmt.Fprintln(messageWriter, stamp, "dsrpc debug", messages)
}
func logInfo(messages ...any) {
stamp := time.Now().Format(time.RFC3339Nano)
fmt.Fprintln(messageWriter, stamp, "info", messages)
stamp := time.Now().Format(time.RFC3339)
fmt.Fprintln(messageWriter, stamp, "dsrpc info", messages)
}
func logError(messages ...any) {
stamp := time.Now().Format(time.RFC3339Nano)
fmt.Fprintln(messageWriter, stamp, "error", messages)
stamp := time.Now().Format(time.RFC3339)
fmt.Fprintln(messageWriter, stamp, "dsrpc error", messages)
}
func logAccess(messages ...any) {
stamp := time.Now().Format(time.RFC3339Nano)
fmt.Fprintln(accessWriter, stamp, "access", messages)
stamp := time.Now().Format(time.RFC3339)
fmt.Fprintln(accessWriter, stamp, "dsrpc access", messages)
}
func SetAccessWriter(writer io.Writer) {