github.com/polarismesh/polaris@v1.17.8/bootstrap/config/default_boot.go (about) 1 /** 2 * Tencent is pleased to support the open source community by making Polaris available. 3 * 4 * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 5 * 6 * Licensed under the BSD 3-Clause License (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * https://opensource.org/licenses/BSD-3-Clause 11 * 12 * Unless required by applicable law or agreed to in writing, software distributed 13 * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 14 * CONDITIONS OF ANY KIND, either express or implied. See the License for the 15 * specific language governing permissions and limitations under the License. 16 */ 17 18 package config 19 20 import ( 21 "fmt" 22 23 "github.com/polarismesh/polaris/common/log" 24 ) 25 26 func defaultBootstrap() Bootstrap { 27 return Bootstrap{ 28 Logger: defaultLoggerOptions(), 29 StartInOrder: map[string]interface{}{ 30 "open": true, 31 "key": "sz", 32 }, 33 PolarisService: PolarisService{ 34 EnableRegister: true, 35 Isolated: false, 36 Services: []*Service{ 37 { 38 Name: "polaris.checker", 39 Namespace: "Polaris", 40 Protocols: []string{ 41 "service-grpc", 42 }, 43 }, 44 }, 45 }, 46 } 47 } 48 49 // defaultLoggerOptions creates default logger options 50 func defaultLoggerOptions() map[string]*log.Options { 51 return map[string]*log.Options{ 52 "config": newLogOptions("runtime", "config"), 53 "auth": newLogOptions("runtime", "auth"), 54 "store": newLogOptions("runtime", "store"), 55 "cache": newLogOptions("runtime", "cache"), 56 "naming": newLogOptions("runtime", "naming"), 57 "healthcheck": newLogOptions("runtime", "healthcheck"), 58 "xdsv3": newLogOptions("runtime", "xdsv3"), 59 "eureka": newLogOptions("runtime", "eureka"), 60 "apiserver": newLogOptions("runtime", "apiserver"), 61 "default": newLogOptions("runtime", "default"), 62 "token-bucket": newLogOptions("runtime", "ratelimit"), 63 "discoverLocal": newLogOptions("statis", "discoverstat"), 64 "local": newLogOptions("statis", "statis"), 65 "HistoryLogger": newLogOptions("operation", "history", func(opt *log.Options) { 66 opt.OnlyContent = true 67 opt.RotationMaxDurationForHour = 24 68 }), 69 "discoverEventLocal": newLogOptions("event", "discoverevent", func(opt *log.Options) { 70 opt.OnlyContent = true 71 }), 72 "cmdb": newLogOptions("runtime", "cmdb"), 73 } 74 } 75 76 func newLogOptions(dir, name string, options ...func(opt *log.Options)) *log.Options { 77 opt := &log.Options{ 78 RotateOutputPath: fmt.Sprintf("log/%s/polaris-%s.log", dir, name), 79 ErrorRotateOutputPath: fmt.Sprintf("log/%s/polaris-%s-error.log", dir, name), 80 RotationMaxSize: 100, 81 RotationMaxAge: 7, 82 RotationMaxBackups: 30, 83 Compress: true, 84 OutputLevel: "info", 85 } 86 for i := range options { 87 options[i](opt) 88 } 89 return opt 90 }