Documentation
¶
Index ¶
- Variables
- func SetFormatter(formatter Formatter)
- func SetLevel(level Level)
- func SetOutput(out io.Writer)
- func Setup(opts Options) (io.Closer, error)
- type Entry
- func WithComponent(component string) *Entry
- func WithComponentAndFields(component string, fields Fields) *Entry
- func WithContext(ctx context.Context) *Entry
- func WithError(err error) *Entry
- func WithField(key string, value interface{}) *Entry
- func WithFields(fields Fields) *Entry
- func WithTime(t time.Time) *Entry
- type Fields
- type Formatter
- type Hook
- type JSONFormatter
- type Level
- type Logger
- type Options
- type TextFormatter
Constants ¶
This section is empty.
Variables ¶
var AllLevels = logrus.AllLevels
AllLevels logrus.AllLevels의 별칭입니다.
var Debug = logrus.Debug
Debug 레벨 로그를 기록합니다.
var Debugf = logrus.Debugf
포맷팅된 Debug 레벨 로그를 기록합니다.
var Error = logrus.Error
Error 레벨 로그를 기록합니다.
var Errorf = logrus.Errorf
포맷팅된 Error 레벨 로그를 기록합니다.
var Fatal = logrus.Fatal
Fatal 레벨 로그를 기록합니다. (이후 os.Exit(1) 호출)
var Fatalf = logrus.Fatalf
포맷팅된 Fatal 레벨 로그를 기록합니다. (이후 os.Exit(1) 호출)
var Info = logrus.Info
Info 레벨 로그를 기록합니다.
var Infof = logrus.Infof
포맷팅된 Info 레벨 로그를 기록합니다.
var Panic = logrus.Panic
Panic 레벨 로그를 기록합니다. (이후 panic() 발생)
var Panicf = logrus.Panicf
포맷팅된 Panic 레벨 로그를 기록합니다. (이후 panic() 발생)
var Trace = logrus.Trace
Trace 레벨 로그를 기록합니다.
var Tracef = logrus.Tracef
포맷팅된 Trace 레벨 로그를 기록합니다.
var Warn = logrus.Warn
Warn 레벨 로그를 기록합니다.
var Warnf = logrus.Warnf
포맷팅된 Warn 레벨 로그를 기록합니다.
Functions ¶
func SetFormatter ¶ added in v1.1.0
func SetFormatter(formatter Formatter)
SetFormatter 전역 로거의 포맷터를 설정합니다.
Types ¶
type Entry ¶ added in v1.1.0
Entry logrus.Entry의 별칭입니다.
func WithComponent ¶
WithComponent 로그의 출처(Component)를 명시하는 'component' 필드를 컨텍스트에 추가합니다.
func WithComponentAndFields ¶
WithComponentAndFields 'component' 필드와 추가적인 구조화된 필드들을 동시에 컨텍스트에 추가합니다.
func WithContext ¶ added in v1.1.0
WithContext 컨텍스트를 로그에 연동합니다. (Trace ID 추적 등에 활용)
func WithFields ¶ added in v1.1.0
WithFields 구조화된 필드(Key-Value)를 로그 컨텍스트에 추가합니다.
type JSONFormatter ¶ added in v1.1.0
type JSONFormatter = logrus.JSONFormatter
JSONFormatter logrus.JSONFormatter의 별칭입니다.
type Level ¶ added in v1.1.0
Level logrus.Level의 별칭입니다.
const ( // PanicLevel 가장 높은 심각도입니다. 로그를 기록한 후 panic()을 호출하여 현재 고루틴을 중단합니다. // 복구 불가능한 치명적인 내부 오류 발생 시 사용합니다. PanicLevel Level = logrus.PanicLevel // FatalLevel 치명적인 오류입니다. 로그를 기록한 후 os.Exit(1)을 호출하여 프로세스를 즉시 종료합니다. // 애플리케이션 시작 실패, 필수 리소스 로드 실패 등 프로세스가 더 이상 진행할 수 없을 때 사용합니다. FatalLevel Level = logrus.FatalLevel // ErrorLevel 에러 상황입니다. 프로세스를 종료하지는 않지만, 관리자의 개입이나 버그 수정이 필요한 상태를 나타냅니다. ErrorLevel Level = logrus.ErrorLevel // WarnLevel 경고 상황입니다. 당장 에러는 아니지만 잠재적인 문제가 있거나 주의가 필요한 상태를 나타냅니다. WarnLevel Level = logrus.WarnLevel // InfoLevel 일반적인 정보입니다. 시스템의 정상적인 작동 흐름이나 상태 변화를 기록합니다. InfoLevel Level = logrus.InfoLevel // DebugLevel 디버깅 정보입니다. 개발 및 테스트 단계에서 문제 해결을 위해 상세한 정보를 기록합니다. DebugLevel Level = logrus.DebugLevel // TraceLevel 가장 세밀한 정보입니다. Debug 레벨보다 더 상세한 데이터 흐름, 내부 변수 상태 등을 추적합니다. TraceLevel Level = logrus.TraceLevel )
type Logger ¶ added in v1.1.0
Logger logrus.Logger의 별칭입니다.
func StandardLogger ¶ added in v1.1.0
func StandardLogger() *Logger
StandardLogger logrus 라이브러리의 전역 표준 로거(Standard Logger) 인스턴스를 반환합니다. (참고: 이 인스턴스는 pkg/log.Setup()을 통해 모든 설정이 완료된 상태입니다.)
type Options ¶ added in v1.1.0
type Options struct {
Name string // 로그 파일명 생성에 사용될 애플리케이션 식별자
Dir string // 로그 파일이 저장될 디렉토리 경로
Level Level // 로그 레벨
MaxAge int // 오래된 로그 삭제 기준일 (일 단위, 0: 삭제 안 함)
MaxSizeMB int // 로그 파일 최대 크기 (MB, 0: 기본값 10MB 사용)
MaxBackups int // 최대 백업 파일 수 (0: 기본값 20개 사용)
EnableCriticalLog bool // ERROR 이상(ERROR, FATAL, PANIC)의 치명적 로그를 별도 파일로 분리 저장할지 여부
EnableVerboseLog bool // DEBUG 이하(DEBUG, TRACE)의 상세 로그를 별도 파일로 분리 저장할지 여부
EnableConsoleLog bool // 표준 출력(Stdout)에도 로그를 출력할지 여부 (개발 환경 권장)
// 로그를 호출한 소스 코드의 위치(파일명:라인번호)를 함께 기록할지 여부
// 예: true로 설정 시 "main.go:55" 처럼 로그가 발생한 위치를 알 수 있어 디버깅에 유용합니다.
ReportCaller bool
// 로그에 출력되는 파일 경로가 너무 길 때, 앞부분을 잘라내어 보기 좋게 만듭니다.
// 예: "github.com/my/project/pkg/server.go" -> prefix가 "github.com/my/project"라면 "pkg/server.go"만 출력됨
CallerPathPrefix string
}
Options 로거 설정을 위한 구조체입니다.
func NewDevelopmentOptions ¶ added in v1.1.0
NewDevelopmentOptions 개발(Development) 환경에 최적화된 로그 설정을 반환합니다.
func NewProductionOptions ¶ added in v1.1.0
NewProductionOptions 운영(Production) 환경에 최적화된 로그 설정을 반환합니다.
type TextFormatter ¶ added in v1.1.0
type TextFormatter = logrus.TextFormatter
TextFormatter logrus.TextFormatter의 별칭입니다.