forked from abu-lang/goabu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.go
36 lines (32 loc) · 877 Bytes
/
init.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
30
31
32
33
34
35
36
// Copyright 2021 Massimo Comuzzo, Michele Pasqua and Marino Miculan
// SPDX-License-Identifier: Apache-2.0
// Package goabu implements a distributed Event-Condition-Action engine with attribute-based interaction.
package goabu
import (
"github.com/abu-lang/goabu/config"
"github.com/hyperjumptech/grule-rule-engine/antlr"
"github.com/hyperjumptech/grule-rule-engine/ast"
"github.com/hyperjumptech/grule-rule-engine/logger"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
)
func init() {
var zapLogger *zap.Logger
if config.Production {
zapLogger = zap.NewNop()
} else {
zapCfg, ok := config.LogPreset("console").(zap.Config)
if !ok {
return
}
zapCfg.Level.SetLevel(zapcore.InfoLevel)
var err error
zapLogger, err = zapCfg.Build()
if err != nil {
return
}
}
antlr.SetLogger(zapLogger)
ast.SetLogger(zapLogger)
logger.SetLogger(zapLogger)
}