func (l *Logging) Apply(c Config) error {
	err := l.SetFormat(c.Format)
	if err != nil {
		return err
	}
	if c.LogSpec == "" {
		c.LogSpec = os.Getenv("FABRIC_LOGGING_SPEC")
	}
	if c.LogSpec == "" {
		c.LogSpec = defaultLevel.String()
	}
	err = l.LoggerLevels.ActivateSpec(c.LogSpec)
	if err != nil {
		return err
	}
	if c.Writer == nil {
		c.Writer = os.Stderr
	}
	l.SetWriter(c.Writer)
	return nil
}
Apply applies the provided configuration to the logging system.
package flogging
import (
	"fmt"
	"io"
	"os"
	"sync"
	zaplogfmt "github.com/sykesm/zap-logfmt"
	"go.uber.org/zap"
	"go.uber.org/zap/zapcore"
	"github.com/hyperledger-labs/fabric-smart-client/platform/view/services/flogging/fabenc"
)
type Config struct {
	Format string
	LogSpec string
	Writer io.Writer
}
type Logging struct {
	*LoggerLevels
	mutex          sync.RWMutex
	encoding       Encoding
	encoderConfig  zapcore.EncoderConfig
	multiFormatter *fabenc.MultiFormatter
	writer         zapcore.WriteSyncer
	observer       Observer
}
func New(c Config) (*Logging, error) {
	encoderConfig := zap.NewProductionEncoderConfig()
	encoderConfig.NameKey = "name"
	l := &Logging{
		LoggerLevels: &LoggerLevels{
			defaultLevel: defaultLevel,
		},
		encoderConfig:  encoderConfig,
		multiFormatter: fabenc.NewMultiFormatter(),
	}
	err := l.Apply(c)
	if err != nil {
		return nil, err
	}
	return l, nil
}