• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Golang gslogger.Get函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/gsdocker/gslogger.Get函数的典型用法代码示例。如果您正苦于以下问题:Golang Get函数的具体用法?Golang Get怎么用?Golang Get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Get函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: NewCodeGen

// NewCodeGen .
func NewCodeGen(rootpath string, skips []string) (gslang.Visitor, error) {

	codeGen := &_CodeGen{
		Log:      gslogger.Get("gen4go"),
		rootpath: rootpath,
		prefix:   make(map[string]string),
	}

	for _, skip := range skips {
		exp, err := regexp.Compile(skip)

		if err != nil {
			return nil, gserrors.Newf(err, "invalid skip regex string :%s", skip)
		}

		codeGen.skips = append(codeGen.skips, exp)
	}

	funcs := template.FuncMap{
		"title":           codeGen.title,
		"title2":          strings.Title,
		"enumFields":      codeGen.enumFields,
		"typeName":        codeGen.typeName,
		"enumRead":        codeGen.enumRead,
		"enumWrite":       codeGen.enumWrite,
		"fieldDecl":       codeGen.fieldDecl,
		"defaultVal":      codeGen.defaultVal,
		"marshalField":    codeGen.marshalField,
		"unmarshalField":  codeGen.unmarshalField,
		"methodDecl":      codeGen.methodDecl,
		"rpcMethodDecl":   codeGen.rpcMethodDecl,
		"unmarshalParam":  codeGen.unmarshalParam,
		"marshalParam":    codeGen.marshalParam,
		"methodCall":      codeGen.methodCall,
		"marshalReturn":   codeGen.marshalReturn,
		"unmarshalReturn": codeGen.unmarshalReturn,
		"notVoid":         gslang.NotVoid,
		"isPOD":           gslang.IsPOD,
		"isAsync":         gslang.IsAsync,
		"isException":     gslang.IsException,
		"enumSize":        gslang.EnumSize,
		"enumType": func(typeDecl ast.Type) string {
			return builtin[gslang.EnumType(typeDecl)]
		},
		"builtin":       gslang.IsBuiltin,
		"marshalParams": codeGen.marshalParams,
		"callback":      codeGen.callback,
		"tagValue":      codeGen.tagValue,
	}

	tpl, err := template.New("t4objc").Funcs(funcs).Parse(t4objc)

	if err != nil {
		return nil, err
	}

	codeGen.tpl = tpl

	return codeGen, nil
}
开发者ID:gsrpc,项目名称:gsrpc,代码行数:61,代码来源:codegen.go


示例2: newContext

func newContext(name string, handler Handler, pipeline *_Pipeline, prev *_Context) (*_Context, error) {
	context := &_Context{
		Log:      gslogger.Get("handler-context"),
		name:     name,
		handler:  handler,
		pipeline: pipeline,
		prev:     prev,
		state:    handlerUnregister,
	}

	context.shared, _ = handler.(SharedHandler)

	err := context.handler.Register(context)

	if err != nil {
		return nil, err
	}

	if context.prev != nil {
		context.prev.next = context
	}

	context.state = handlerRegister

	return context, nil

}
开发者ID:gsrpc,项目名称:gorpc,代码行数:27,代码来源:handler.go


示例3: Open

// Open create new tsdb with root directory
func Open(filepath string) (DataSource, error) {

	if !fs.Exists(filepath) {
		err := os.MkdirAll(filepath, 0644)
		if err != nil {
			return nil, err
		}
	}

	idgen, err := newSEQIDGen(filepath)

	if err != nil {
		return nil, err
	}

	persistence, err := newDB(filepath)

	if err != nil {
		return nil, err
	}

	return &_DataSource{
		Log:         gslogger.Get("tsdb"),
		SEQIDGen:    idgen,
		Persistence: persistence,
		cached:      make(map[string]*_Cached),
		cachedsize:  gsconfig.Int("tsdb.cached.size", 1024),
	}, nil
}
开发者ID:gschat,项目名称:tsdb,代码行数:30,代码来源:datasource.go


示例4: newClientHandler

func (proxy *_Proxy) newClientHandler() gorpc.Handler {

	return &_Client{
		Log:     gslogger.Get("gsproxy-client"),
		context: proxy,
	}
}
开发者ID:gsdocker,项目名称:gsproxy,代码行数:7,代码来源:client.go


示例5: Visit

// Visit visit ast tree
func (compiler *Compiler) Visit(codeGen Visitor) (err error) {

	defer func() {
		if e := recover(); e != nil {

			gserr, ok := e.(gserrors.GSError)

			if ok {
				err = gserr
			} else {
				err = gserrors.Newf(e.(error), "catch unknown error")
			}
		}
	}()

	gen := &_Visitor{
		Log:      gslogger.Get("codegen"),
		codeGen:  codeGen,
		module:   compiler.module,
		compiler: compiler,
	}

	gen.visit()

	return
}
开发者ID:gsrpc,项目名称:gslang,代码行数:27,代码来源:compiler.go


示例6: Build

// Build create new Pipeline
func (builder *PipelineBuilder) Build(name string) (Pipeline, error) {

	pipeline := &_Pipeline{
		Log:        gslogger.Get("pipeline"),
		name:       name,
		timewheel:  builder.timewheel,
		sendcached: make(chan func() (*Message, error), builder.cachedsize),
		closedflag: make(chan bool),
	}

	close(pipeline.closedflag)

	pipeline.Sink = NewSink(name, pipeline, pipeline.TimeWheel(), builder.timeout)

	var err error

	for i, f := range builder.handlers {
		pipeline.tail, err = newContext(builder.names[i], f(), pipeline, pipeline.tail)

		if pipeline.header == nil {
			pipeline.header = pipeline.tail
		}

		if err != nil {
			return nil, err
		}
	}

	return pipeline, err
}
开发者ID:gsrpc,项目名称:gorpc,代码行数:31,代码来源:pipeline.go


示例7: NewHeartbeatHandler

// NewHeartbeatHandler create new heartbeat handler
func NewHeartbeatHandler(timeout time.Duration) gorpc.Handler {
	return &_HeartbeatHandler{
		Log:       gslogger.Get("heartbeat"),
		timeout:   timeout,
		timestamp: time.Now(),
	}
}
开发者ID:gsrpc,项目名称:gorpc,代码行数:8,代码来源:heartbeat.go


示例8: New

// New create new gsdocker runner
func New(name string) Runner {
	runner := &_Runner{
		Log:              gslogger.Get(name),
		flagString:       make(map[string]*string),
		flagInt:          make(map[string]*int64),
		flagUint:         make(map[string]*uint64),
		flagFloat32:      make(map[string]*float64),
		flagFloat64:      make(map[string]*float64),
		flagSecond:       make(map[string]*uint64),
		flagMilliseconds: make(map[string]*uint64),
		fullname:         make(map[string]string),
	}

	runner.FlagString(
		"log", "gsrunner.log", "", "the gsrunner log root path",
	).FlagString(
		"level", "gsrunner.log.level", "", "the gsrunner log level",
	).FlagString(
		"pprof", "gsrunner.pprof", "", "set gsrunner pprof listen address",
	).FlagString(
		"config", "gsrunner.config", "", "set gsrunner config file",
	).FlagString(
		"registry", "gsrunner.registry", "", "set the rpc services registry file",
	)

	return runner
}
开发者ID:gsdocker,项目名称:gsrunner,代码行数:28,代码来源:runner.go


示例9: newEval

func newEval(errorHandler ErrorHandler, module *ast.Module) Eval {
	return &_Eval{
		Log:          gslogger.Get("eval"),
		module:       module,
		errorHandler: errorHandler,
	}
}
开发者ID:gsrpc,项目名称:gslang,代码行数:7,代码来源:eval.go


示例10: NewCryptoClient

// NewCryptoClient .
func NewCryptoClient(device *gorpc.Device, dhKey *DHKey) gorpc.Handler {
	return &_CryptoClient{
		Log:    gslogger.Get("crpyto-client"),
		dhKey:  dhKey,
		device: device,
	}
}
开发者ID:gsrpc,项目名称:gorpc,代码行数:8,代码来源:dh.go


示例11: newTunnelServer

func (proxy *_Proxy) newTunnelServer() gorpc.Handler {
	return &_TunnelServerHandler{
		Log:   gslogger.Get("agent-server-tunnel"),
		proxy: proxy,
		id:    proxy.tunnelID(),
	}
}
开发者ID:gsdocker,项目名称:gsproxy,代码行数:7,代码来源:handlers.go


示例12: newTunnelClient

func (system *_System) newTunnelClient(name string) gorpc.Handler {
	return &_TunnelClient{
		Log:     gslogger.Get("gsagent-tunnel"),
		name:    name,
		system:  system,
		timeout: system.timeout,
	}
}
开发者ID:gsdocker,项目名称:gsproxy,代码行数:8,代码来源:tunnel.go


示例13: NewAcceptor

// NewAcceptor create new server channel acceptor
func NewAcceptor(name string, builder *PipelineBuilder) *Acceptor {
	return &Acceptor{
		Log:     gslogger.Get(name),
		builder: builder,
		timeout: gsconfig.Seconds("timeout", 5),
		name:    name,
	}
}
开发者ID:gsrpc,项目名称:gorpc,代码行数:9,代码来源:acceptor.go


示例14: newTransProxyHandler

func (proxy *_Proxy) newTransProxyHandler() gorpc.Handler {
	return &_TransProxyHandler{
		Log:     gslogger.Get("trans-proxy"),
		proxy:   proxy,
		servers: make(map[uint16]Server),
		tunnels: make(map[byte]Server),
	}
}
开发者ID:gsdocker,项目名称:gsproxy,代码行数:8,代码来源:handlers.go


示例15: main

func main() {
	gslogger.Console("$content", "2006-01-02 15:04:05.999999")
	gslogger.NewFlags(gslogger.ERROR | gslogger.WARN | gslogger.INFO)
	log := gslogger.Get("gsrpc")

	defer func() {
		if e := recover(); e != nil {
			log.E("%s", e)
		}

		gslogger.Join()
	}()

	flag.Parse()

	*output, _ = filepath.Abs(*output)

	log.I("Start gsRPC With Target Language(%s)", *lang)

	codegenF, ok := langs[*lang]

	if !ok {
		log.E("unknown gsrpc object language :%s", *lang)
		os.Exit(1)
	}

	codegen, err := codegenF(*output, []string{"github.com/gsrpc/gslang"})

	if err != nil {
		gserrors.Panicf(err, "create language(%s) codegen error", *lang)
	}

	compiler := gslang.NewCompiler("gsrpc", gslang.HandleError(func(err *gslang.Error) {
		gserrors.Panicf(err.Orignal, "parse %s error\n\t%s", err.Start, err.Text)
	}))

	for _, file := range flag.Args() {
		log.I("Compile gsLang File :%s", file)
		if err := compiler.Compile(file); err != nil {
			gserrors.Panicf(err, "compile %s error", file)
		}
	}

	log.I("Link ...")
	err = compiler.Link()

	if err != nil {
		gserrors.Panicf(err, "link error")
	}

	log.I("Output Directory :%s", *output)

	if err := compiler.Visit(codegen); err != nil {
		gserrors.Panicf(err, "generate language codes(%s) error", *lang)
	}

	log.I("Run gsRPC Compile -- Success")
}
开发者ID:gsrpc,项目名称:gsrpc,代码行数:58,代码来源:main.go


示例16: parse

func (compiler *Compiler) parse(lexer *lexer.Lexer, errorHandler ErrorHandler) *ast.Script {

	return (&Parser{
		Log:          gslogger.Get("parser"),
		lexer:        lexer,
		script:       compiler.module.NewScript(lexer.String()),
		errorHandler: errorHandler,
	}).parse()
}
开发者ID:gsrpc,项目名称:gslang,代码行数:9,代码来源:parser.go


示例17: Build

// Build .
func (builder *ProxyBuilder) Build(name string) Context {

	proxy := &_Proxy{
		Log:     gslogger.Get("gsproxy"),
		proxy:   builder.proxy,
		clients: make(map[string]*_Client),
		name:    name,
		tunnels: make(map[byte]byte),
	}

	proxy.frontend = gorpc.NewAcceptor(
		fmt.Sprintf("%s.frontend", name),
		gorpc.BuildPipeline(time.Millisecond*10).Handler(
			"gsproxy-profile",
			gorpc.ProfileHandler,
		).Handler(
			"gsproxy-hb",
			func() gorpc.Handler {
				return handler.NewHeartbeatHandler(builder.timeout)
			},
		).Handler(
			"gsproxy-dh",
			func() gorpc.Handler {
				return handler.NewCryptoServer(builder.dhkeyResolver)
			},
		).Handler(
			transProxyHandler,
			proxy.newTransProxyHandler,
		).Handler(
			"gsproxy-client",
			proxy.newClientHandler,
		),
	)

	proxy.backend = gorpc.NewAcceptor(
		fmt.Sprintf("%s.backend", name),
		gorpc.BuildPipeline(time.Millisecond*10).Handler(
			tunnelHandler,
			proxy.newTunnelServer,
		),
	)

	go func() {
		if err := gorpc.TCPListen(proxy.backend, builder.laddrE); err != nil {
			proxy.E("start agent backend error :%s", err)
		}
	}()

	go func() {
		if err := gorpc.TCPListen(proxy.frontend, builder.laddrF); err != nil {
			proxy.E("start agent frontend error :%s", err)
		}
	}()

	return proxy
}
开发者ID:gsdocker,项目名称:gsproxy,代码行数:57,代码来源:gsproxy.go


示例18: NewSink

// NewSink .
func NewSink(name string, channel MessageChannel, timeWheel *timer.Wheel, timeout time.Duration) Sink {
	return &_Sink{
		Log:         gslogger.Get("sink"),
		name:        name,
		timeout:     timeout,
		dispatchers: make(map[uint16]Dispatcher),
		promises:    make(map[uint32]Promise),
		channel:     channel,
		timeWheel:   timeWheel,
	}
}
开发者ID:gsrpc,项目名称:gorpc,代码行数:12,代码来源:sink.go


示例19: NewCompiler

// NewCompiler .
func NewCompiler(name string, errorHandler ErrorHandler) *Compiler {

	module := ast.NewModule(name)

	return &Compiler{
		Log:          gslogger.Get("compiler"),
		module:       module,
		errorHandler: errorHandler,
		eval:         newEval(errorHandler, module),
	}

}
开发者ID:gsrpc,项目名称:gslang,代码行数:13,代码来源:compiler.go


示例20: NewLexer

//NewLexer create new gslang lexer
func NewLexer(tag string, reader io.Reader) *Lexer {
	return &Lexer{
		Log:    gslogger.Get("gslang[lexer]"),
		reader: bufio.NewReader(reader),
		ws:     1<<'\t' | 1<<'\n' | 1<<'\r' | 1<<' ',
		position: Position{
			FileName: tag,
			Lines:    1,
			Column:   1,
		},
		curr: rune(TokenEOF),
	}
}
开发者ID:gsrpc,项目名称:gslang,代码行数:14,代码来源:lexer.go



注:本文中的github.com/gsdocker/gslogger.Get函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang gorpc.Context类代码示例发布时间:2022-05-23
下一篇:
Golang gserrors.Panicf函数代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap