mirror of
https://gitee.com/johng/gf.git
synced 2024-11-30 03:07:45 +08:00
ae4f14c2e2
* improve logging feature, add LevelPrint configuration for glog.Logger; add package internal/instance * improve command build * add default logger for panic message printing if no logger set * up * fix scheduler when timer triggers in less than one second for package gcron * up
23 lines
691 B
Go
23 lines
691 B
Go
// Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
|
|
//
|
|
// This Source Code Form is subject to the terms of the MIT License.
|
|
// If a copy of the MIT was not distributed with this file,
|
|
// You can obtain one at https://github.com/gogf/gf.
|
|
|
|
package gins
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/gogf/gf/v2/internal/instance"
|
|
"github.com/gogf/gf/v2/net/gclient"
|
|
)
|
|
|
|
// HttpClient returns an instance of http client with specified name.
|
|
func HttpClient(name ...interface{}) *gclient.Client {
|
|
var instanceKey = fmt.Sprintf("%s.%v", frameCoreComponentNameHttpClient, name)
|
|
return instance.GetOrSetFuncLock(instanceKey, func() interface{} {
|
|
return gclient.New()
|
|
}).(*gclient.Client)
|
|
}
|