[go-nuts] Re: Elastic synchronised logging : What do you think ?

2019-03-16 Thread caijianyu
I'm not sure if the log produce more than consume by the func 'centrale' in the same period of time, will 'buff' be larger and larger and cost too much memory. For example, The log comes from network and write into a disk but network speed is greater than disk write speed. So is there any way to

[go-nuts] Re: Elastic synchronised logging : What do you think ?

2019-03-17 Thread Christophe Meessen
Please replace 'case ticker.C' with 'case <-ticker.C' in my previous code. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.c

[go-nuts] Re: Elastic synchronised logging : What do you think ?

2019-03-17 Thread Louki Sumirniy
I just wrote this a bit over a month ago: https://git.parallelcoin.io/dev/pod/src/branch/master/pkg/util/cl It was brutal simple before (only one 600 line source lots of type switches) but it now also has a registration system for setting up arbitrary subsystem log levels. By the way, I could

[go-nuts] Re: Elastic synchronised logging : What do you think ?

2019-03-17 Thread Louki Sumirniy
I didn't even think of the idea of using buffered channels, I was trying to not lean too far in towards that side of thing, but it is good you mention it, it would be simple to just pre-allocate a buffer and trigger the print call only when that buffer fills up (say like half a screenful, maybe

Re: [go-nuts] Re: Elastic synchronised logging : What do you think ?

2019-03-16 Thread Burak Serdar
On Sat, Mar 16, 2019 at 11:10 PM wrote: > > I'm not sure if the log produce more than consume by the func 'centrale' in > the same period of time, will 'buff' be larger and larger and cost too much > memory. > For example, The log comes from network and write into a disk but network > speed is

Re: [go-nuts] Re: Elastic synchronised logging : What do you think ?

2019-03-16 Thread caijianyu
The solution you proposed is better now, but if the log produce speed is still too large, I think the printf function should not use a new goroutine( by go func(){r:=... bufferchan<-r }), because the internal bytes.Buffer{} might reaches the certain size always, it cannot provide the ablibity