mirror of
https://github.com/fatedier/frp.git
synced 2025-07-27 07:35:07 +00:00
support yaml/json/toml configuration format, make ini deprecated (#3599)
This commit is contained in:
@@ -29,15 +29,14 @@ func init() {
|
||||
Log.SetLogFuncCallDepth(Log.GetLogFuncCallDepth() + 1)
|
||||
}
|
||||
|
||||
func InitLog(logWay string, logFile string, logLevel string, maxdays int64, disableLogColor bool) {
|
||||
SetLogFile(logWay, logFile, maxdays, disableLogColor)
|
||||
func InitLog(logFile string, logLevel string, maxdays int64, disableLogColor bool) {
|
||||
SetLogFile(logFile, maxdays, disableLogColor)
|
||||
SetLogLevel(logLevel)
|
||||
}
|
||||
|
||||
// SetLogFile to configure log params
|
||||
// logWay: file or console
|
||||
func SetLogFile(logWay string, logFile string, maxdays int64, disableLogColor bool) {
|
||||
if logWay == "console" {
|
||||
func SetLogFile(logFile string, maxdays int64, disableLogColor bool) {
|
||||
if logFile == "console" {
|
||||
params := ""
|
||||
if disableLogColor {
|
||||
params = `{"color": false}`
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright 2020 guylewin, guy@lewin.co.il
|
||||
// Copyright 2023 The frp Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
23
pkg/util/util/types.go
Normal file
23
pkg/util/util/types.go
Normal file
@@ -0,0 +1,23 @@
|
||||
// Copyright 2023 The frp Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package util
|
||||
|
||||
func EmptyOr[T comparable](v T, fallback T) T {
|
||||
var zero T
|
||||
if zero == v {
|
||||
return fallback
|
||||
}
|
||||
return v
|
||||
}
|
Reference in New Issue
Block a user