-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogger.go
29 lines (26 loc) · 1.2 KB
/
logger.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Package solc provides utilities for managing and interacting with the Solidity compiler.
package solc
import (
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
)
// GetProductionLogger creates and returns a new production logger using the zap library.
// The production logger is optimized for performance and is suitable for use in production environments.
// The log level can be set using the provided level parameter.
func GetProductionLogger(level zapcore.Level) (*zap.Logger, error) {
config := zap.NewProductionConfig()
config.Level = zap.NewAtomicLevelAt(level)
config.EncoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder
logger, err := config.Build()
return logger, err
}
// GetDevelopmentLogger creates and returns a new development logger using the zap library.
// The development logger is optimized for development and debugging, providing more detailed logs.
// The log level can be set using the provided level parameter.
func GetDevelopmentLogger(level zapcore.Level) (*zap.Logger, error) {
config := zap.NewDevelopmentConfig()
config.Level = zap.NewAtomicLevelAt(level)
config.EncoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder
logger, err := config.Build()
return logger, err
}