Documentation
¶
Index ¶
- func Debug(msg string, fields ...zap.Field)
- func Error(msg string, fields ...zap.Field)
- func Fatal(msg string, fields ...zap.Field)
- func GetLogger() *zap.Logger
- func Info(msg string, fields ...zap.Field)
- func InitGlobalLogger(config Config) error
- func NewZapLogger(config Config) (*zap.Logger, error)
- func Sync() error
- func Warn(msg string, fields ...zap.Field)
- type Config
- type ConsoleOutput
- func (c *ConsoleOutput) Confirm(prompt string) bool
- func (c *ConsoleOutput) Print(msg string)
- func (c *ConsoleOutput) PrintError(err error)
- func (c *ConsoleOutput) PrintProgress(msg string)
- func (c *ConsoleOutput) PrintSuccess(msg string)
- func (c *ConsoleOutput) PrintVerbose(msg string)
- func (c *ConsoleOutput) Printf(format string, args ...interface{})
- type Format
- type Level
- type Logger
- type OutputWriter
- type TestOutput
- func (t *TestOutput) Clear()
- func (t *TestOutput) Confirm(prompt string) bool
- func (t *TestOutput) ContainsConfirmPrompt(partialMsg string) bool
- func (t *TestOutput) ContainsError(partialMsg string) bool
- func (t *TestOutput) ContainsMessage(partialMsg string) bool
- func (t *TestOutput) ContainsProgress(partialMsg string) bool
- func (t *TestOutput) ContainsSuccess(partialMsg string) bool
- func (t *TestOutput) ContainsVerbose(partialMsg string) bool
- func (t *TestOutput) Print(msg string)
- func (t *TestOutput) PrintError(err error)
- func (t *TestOutput) PrintProgress(msg string)
- func (t *TestOutput) PrintSuccess(msg string)
- func (t *TestOutput) PrintVerbose(msg string)
- func (t *TestOutput) Printf(format string, args ...interface{})
- func (t *TestOutput) SetConfirmReturn(val bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewZapLogger ¶
NewZapLogger は設定に基づいてzapロガーを初期化する関数
Types ¶
type Config ¶
type Config struct {
// 基本設定
Enabled bool `yaml:"enabled"` // ロギングを有効にするか
Level Level `yaml:"level"` // "debug", "info", "warn", "error"
// ファイル出力設定
File string `yaml:"file"` // ログファイルパス、空の場合はファイル出力なし
MaxSize int `yaml:"max_size"` // ログファイルの最大サイズ (MB)
MaxAge int `yaml:"max_age"` // ログファイルの保持日数
MaxFiles int `yaml:"max_files"` // 保持する古いログファイル数
// 出力フォーマット
Format Format `yaml:"format"` // "json", "text"など
// コンソール出力設定
ConsoleOutput bool `yaml:"console_output"` // コンソールにも出力するか
Color bool `yaml:"color"` // カラー出力を使用するか
Verbose bool `yaml:"verbose"` // 詳細出力を有効にするか
}
Config represents logging configuration
func LoadConfigFromYAML ¶
LoadConfigFromYAML loads logging configuration from the specified YAML file.
func LoadConfigFromYAMLContent ¶
LoadConfigFromYAMLContent loads logging configuration from YAML content string.
func (*Config) IsValidFormat ¶
IsValidFormat はフォーマットが有効かどうかを検証する
type ConsoleOutput ¶
ConsoleOutput は標準出力へのOutputWriter実装
func (*ConsoleOutput) Confirm ¶
func (c *ConsoleOutput) Confirm(prompt string) bool
Confirm asks for user confirmation
func (*ConsoleOutput) Print ¶
func (c *ConsoleOutput) Print(msg string)
Print outputs a standard message
func (*ConsoleOutput) PrintError ¶
func (c *ConsoleOutput) PrintError(err error)
PrintError outputs an error message
func (*ConsoleOutput) PrintProgress ¶
func (c *ConsoleOutput) PrintProgress(msg string)
PrintProgress outputs a progress message
func (*ConsoleOutput) PrintSuccess ¶
func (c *ConsoleOutput) PrintSuccess(msg string)
PrintSuccess outputs a success message
func (*ConsoleOutput) PrintVerbose ¶
func (c *ConsoleOutput) PrintVerbose(msg string)
PrintVerbose outputs a message only in verbose mode
func (*ConsoleOutput) Printf ¶
func (c *ConsoleOutput) Printf(format string, args ...interface{})
Printf outputs a formatted standard message
type Logger ¶
type Logger interface {
Debug(msg string, fields ...zapcore.Field)
Info(msg string, fields ...zapcore.Field)
Warn(msg string, fields ...zapcore.Field)
Error(msg string, fields ...zapcore.Field)
Fatal(msg string, fields ...zapcore.Field)
}
Logger はアプリケーションで使用するロガーインターフェース
type OutputWriter ¶
type OutputWriter interface {
// 標準メッセージを出力
Print(msg string)
Printf(format string, args ...interface{})
// 進捗状況を出力
PrintProgress(msg string)
// 成功メッセージを出力
PrintSuccess(msg string)
// エラーメッセージを出力
PrintError(err error)
// 詳細モード時のみ出力
PrintVerbose(msg string)
// ユーザーの確認を得る
Confirm(prompt string) bool
}
OutputWriter はユーザー向け出力を扱うインターフェース
type TestOutput ¶
type TestOutput struct {
Messages []string
ErrorMessages []string
ProgressMsgs []string
SuccessMsgs []string
VerboseMsgs []string
ConfirmPrompts []string
ConfirmReturn bool // Confirmメソッドの戻り値を制御
Verbose bool // 詳細出力モードの制御
}
TestOutput はテスト用の出力キャプチャ
func (*TestOutput) Confirm ¶
func (t *TestOutput) Confirm(prompt string) bool
Confirm simulates user confirmation
func (*TestOutput) ContainsConfirmPrompt ¶
func (t *TestOutput) ContainsConfirmPrompt(partialMsg string) bool
ContainsConfirmPrompt checks if any confirmation prompt contains the given text
func (*TestOutput) ContainsError ¶
func (t *TestOutput) ContainsError(partialMsg string) bool
ContainsError checks if any error message contains the given text
func (*TestOutput) ContainsMessage ¶
func (t *TestOutput) ContainsMessage(partialMsg string) bool
ContainsMessage checks if any standard message contains the given text
func (*TestOutput) ContainsProgress ¶
func (t *TestOutput) ContainsProgress(partialMsg string) bool
ContainsProgress checks if any progress message contains the given text
func (*TestOutput) ContainsSuccess ¶
func (t *TestOutput) ContainsSuccess(partialMsg string) bool
ContainsSuccess checks if any success message contains the given text
func (*TestOutput) ContainsVerbose ¶
func (t *TestOutput) ContainsVerbose(partialMsg string) bool
ContainsVerbose checks if any verbose message contains the given text
func (*TestOutput) PrintError ¶
func (t *TestOutput) PrintError(err error)
PrintError outputs an error message
func (*TestOutput) PrintProgress ¶
func (t *TestOutput) PrintProgress(msg string)
PrintProgress outputs a progress message
func (*TestOutput) PrintSuccess ¶
func (t *TestOutput) PrintSuccess(msg string)
PrintSuccess outputs a success message
func (*TestOutput) PrintVerbose ¶
func (t *TestOutput) PrintVerbose(msg string)
PrintVerbose outputs a message only in verbose mode
func (*TestOutput) Printf ¶
func (t *TestOutput) Printf(format string, args ...interface{})
Printf outputs a formatted standard message
func (*TestOutput) SetConfirmReturn ¶
func (t *TestOutput) SetConfirmReturn(val bool)
SetConfirmReturn sets the return value for Confirm method