log

package
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2026 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package logは、iscp-go内で利用するロガーのパッケージです。

Example (StdLogger)
ctx := context.Background()
testee := NewStd()
log.SetOutput(os.Stdout)
log.SetFlags(log.Lshortfile)
testee.Infof(ctx, "message %s", "info")
testee.Warnf(ctx, "message %s", "warn")
testee.Errorf(ctx, "message %s", "error")
testee.Debugf(ctx, "message %s", "debug")
Output:
logger_std_test.go:28: INFO: message info
logger_std_test.go:29: WARN: message warn
logger_std_test.go:30: ERROR: message error
logger_std_test.go:31: DEBUG: message debug

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func TrackMessageID

func TrackMessageID(ctx context.Context) string

TrackMessageIDは、コンテキストにセットされたメッセージIDを取得します。

func TrackTransportID

func TrackTransportID(ctx context.Context) string

TrackTransportIDは、コンテキストにセットされたトランスポートIDを取得します。

func WithTrackMessageID

func WithTrackMessageID(ctx context.Context) context.Context

WithTrackMessageIDは、新たにメッセージIDを採番しコンテキストにセットします。

メッセージIDはメッセージ受信したタイミングでセットします。 ここで設定されたメッセージIDは常にログ出力します。

func WithTrackTransportID

func WithTrackTransportID(ctx context.Context) context.Context

WithTrackTransportIDは、新たにトランスポートIDを採番しコンテキストにセットします。

トランスポートIDはトランスポートが開通されたタイミングでセットします。 ここで設定されたトランスポートIDは常にログ出力します。

Types

type Logger

type Logger interface {
	Infof(context.Context, string, ...any)
	Warnf(context.Context, string, ...any)
	Errorf(context.Context, string, ...any)
	Debugf(context.Context, string, ...any)
}

Loggerは、iscp-go内で使用するロガーインターフェースです。

func NewNop

func NewNop() Logger

NewNopは、何も出力しないロガーを返却します。

func NewStd

func NewStd() Logger

NewStdは、`log` パッケージのロガーを返却します。

func NewStdWith

func NewStdWith(l *log.Logger) Logger

NewStdは、`log` パッケージのロガーを返却します。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL