<FromGitter>
<robacarp> @PlayLights_twitter write them to redis or something, and then have another client which listens and dumps to the logs
<FromGitter>
<robacarp> Or, if you can, just don’t log! 😈
<FromGitter>
<Blacksmoke16> oo this would be a good feature for Crylog
<FromGitter>
<PlayLights_twitter> @robacarp is like a problem because legal people need it. So you mean a crystal application specific to write logs?
<FromGitter>
<robacarp> Aw laws. Ruining the fun.
<FromGitter>
<Blacksmoke16> monolog has some neat handlers that do something similar to this
<FromGitter>
<Blacksmoke16> ```code paste, see link```
<FromGitter>
<Blacksmoke16> and
<FromGitter>
<Blacksmoke16> `BufferHandler: This handler will buffer all the log records it receives until close() is called at which point it will call handleBatch() on the handler it wraps with all the log messages at once. This is very useful to send an email with all records at once for example instead of having one mail for every log record.`
<FromGitter>
<robacarp> A redis server can handle the throughput, and a secondary app on the Same or alternate server to extract the logs and write to cloud watch or whatever durable store you’re using
<FromGitter>
<PlayLights_twitter> Im currently writing the logs to STDOUT and ECS send it to CloudWatch
<FromGitter>
<Blacksmoke16> or even publish messages to a queue and process them asynchronously
<FromGitter>
<PlayLights_twitter> it has the sync as tru
<FromGitter>
<PlayLights_twitter> true
<FromGitter>
<PlayLights_twitter> so I think it makes it slow
<FromGitter>
<robacarp> @Blacksmoke16 redis for the queue!
<FromGitter>
<PlayLights_twitter> I think I can spawn fiber to send it to redis?
<FromGitter>
<Blacksmoke16> mosquito for the worker ;P
<FromGitter>
<robacarp> o/ if you need it
<FromGitter>
<robacarp> A redis blpop would do the trick
<FromGitter>
<Blacksmoke16> assuming your app would eventually yield to allow the spawned fiber to execute
<FromGitter>
<robacarp> Yeah a high performance app with a plain fiber sounds risky to me
<FromGitter>
<Blacksmoke16> i personally like the queue/async idea the best
<FromGitter>
<Blacksmoke16> since the logs sound like they're important youd get retry and would store failed ones so you dont lose them
<FromGitter>
<robacarp> Rblpoplpush!
<FromGitter>
<PlayLights_twitter> yea you right, I can try sidekiq which I'm familiar with from ruby
<FromGitter>
<PlayLights_twitter> or what do you think?
<FromGitter>
<PlayLights_twitter> but primary is it faster to send it to an asynchronous worker than writing to STDOUT buffer?
<FromGitter>
<Blacksmoke16> dont know
<FromGitter>
<Blacksmoke16> sending it to worker would be a `zadd` redis command
<FromGitter>
<Blacksmoke16> but youd have to bench mark it
<FromGitter>
<Blacksmoke16> but im off to bed for now o/
<FromGitter>
<robacarp> Stdout is disk; is slow
<FromGitter>
<PlayLights_twitter> intertings
<FromGitter>
<PlayLights_twitter> have you see this message before?
<FromGitter>
<PlayLights_twitter> GC Warning: Repeated allocation of very large block (appr. size 12742656): ⏎ May lead to memory leak and poor performance
<FromGitter>
<robacarp> Nope
alex``` has quit [Quit: WeeChat 2.5]
pracabor is now known as robacarp
<FromGitter>
<PlayLights_twitter> Thanks for you help guys
<FromGitter>
<PlayLights_twitter> Handling a hight performance application is a complex task
<FromGitter>
<robacarp> Divide it however you can, and scale it by that
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
<woodruffw>
any pointers (sorry) on registering some allocated memory with crystal's GC? i'm writing some bindings for a library that does internal allocations, and i want crystal to take ownership of those allocations
<woodruffw>
i'll fall back on creating a duplicate if necessary, just wondering if i'm missing anything
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
teardown has quit [Ping timeout: 245 seconds]
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
_whitelogger has joined #crystal-lang
teardown has joined #crystal-lang
<oprypin>
woodruffw, i think it doesn't work well like that. either you allocate in crystal or you don't
<oprypin>
but i think u can add the pointer as an instance variable to something
<oprypin>
nvm, crystal won't even try to deallocate that one, my suggestion would solve the opposite problem
<FromGitter>
<dscottboggs_gitlab> woodruffw -- you're looking for `GC.malloc` or perhaps `GC.malloc_atomic` I believe? Unless you're receiving the pointer from a `fun`, in which case, you should use `LibC.free` in a `finalize` method of the class which aquires ownership of the pointer.
<FromGitter>
<dscottboggs_gitlab> I'm just curious. TBH I just found it looking for the event-loop startup.
<oprypin>
dscottboggs_gitlab: could very easily be defined by compiler magic. it can't be turtles all the way down
<FromGitter>
<dscottboggs_gitlab> why can't it? Crystal supports all of the low-level features of C, even inline assembly. But I take your point that it might not be
<oprypin>
i'm curious, should i just dump all those bugs with compiler's "to_s" functionality? i've been trying to fix them (first batch in https://github.com/crystal-lang/crystal/pull/7886) but i'm burning out waay to fast on messing with the parser
<oprypin>
the thing is, it might not be well received just because it's not "fun" or the bugs may not be "realistic" or affecting anyone
moei has quit [Ping timeout: 246 seconds]
laaron- has quit [Remote host closed the connection]
laaron has joined #crystal-lang
alex`` has joined #crystal-lang
lucasb has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
sz0 has quit [Quit: Connection closed for inactivity]
thodoris has joined #crystal-lang
return0e has quit [Remote host closed the connection]
return0e has joined #crystal-lang
<FromGitter>
<r00ster91> imo they should still be fixed
<FromGitter>
<r00ster91> maybe someone still hits them someday
<FromGitter>
<PlayLights_twitter> Is it fine to wrap code inside a spawn with a rescue to avoid the spawn to crash?
<FromGitter>
<PlayLights_twitter> or is a bad practice?
<FromGitter>
<PlayLights_twitter> :p
<FromGitter>
<r00ster91> I don't think it's good practice to ignore all errors that might happen, you should instead handle them and improve/fix your program
<FromGitter>
<r00ster91> to prevent them from happening in the first place
<FromGitter>
<PlayLights_twitter> Yeah actually I purpose is to be sure the spawn is running when events occurs, but I should have a log there to see what happened and improve it right?
<FromGitter>
<r00ster91> or exception.inspect_with_backtrace
<FromGitter>
<watzon> That would be helpful too
<FromGitter>
<PlayLights_twitter> never heard `inspect_with_backtrace` before, interesting, thanks guys
<FromGitter>
<PlayLights_twitter> about exception, in ruby is not good to use Exception since it could even syntax errors, but in crystal is it fine?
<FromGitter>
<r00ster91> I would catch a specific `Exception` like `TypeCastError` to be more clear but if there are various different exceptions then you can leave it as `rescue exception`
<FromGitter>
<j8r> What is `Exception+` as a type?
<rkeene>
So... who is getting their Vlang on ? ;-)
pvn has joined #crystal-lang
<FromGitter>
<dscottboggs_gitlab> is it out now?
<FromGitter>
<dscottboggs_gitlab> @j8r `Exception+` is any type which inherits from `Exception`
<rkeene>
VLang was open sourced
<FromGitter>
<dscottboggs_gitlab> sweet I'll have to take a look around this week. I'm not super excited about it though. It just seems like a lanugage that implements the features people actually want from Go. Which is cool and all, but I'm not a huge fan of Go besides as an educational tool.
<FromGitter>
<dscottboggs_gitlab> Ugh, I wish more languages cared about having nice syntax.
<oprypin>
dscottboggs_gitlab, your summary resonates with me :)
<FromGitter>
<dscottboggs_gitlab> :)
<FromGitter>
<tenebrousedge> I'm really hoping that Crystal will replace Golang
<oprypin>
well you shouldnt
<oprypin>
just because there's no chance of it happening
<FromGitter>
<tenebrousedge> I'm sure all sorts of human suffering is endemic to our condition, but that doesn't mean that one can't hope for its improvement
<FromGitter>
<watzon> I hope it will too
<FromGitter>
<watzon> I'm sure it won't
<FromGitter>
<watzon> But one can hop
<FromGitter>
<dscottboggs_gitlab> idk like I said I see go as a DSL for web stuff, and crystal has a lot more potential. There's already work to make a desktop app library, and personally I think the biggest area where Crystal could shine is as a replacement for python in the data science community
<oprypin>
V is interesting because it might actually be a usable base for making your own language
<FromGitter>
<watzon> Except it's a mess
<oprypin>
oh it is?
<FromGitter>
<watzon> Yup
<FromGitter>
<watzon> Just got released
<FromGitter>
<watzon> Almost completely unusable on most people's machines
<FromGitter>
<watzon> Although it looks like it just got updated
<FromGitter>
<watzon> So I'll try again
<FromGitter>
<dscottboggs_gitlab> I've even been thinking about the potential to have a lifetime annotation system as a Crystal DSL using macros and pointers. Not that I could do that right now, but it seems feasible, whereas, with Go, there's no flexibility for adding that sort of thing. No macro system, no templating, no null-safety, the list goes on.
<rkeene>
dscottboggs, Have you considered Tcl ? :-D
<FromGitter>
<dscottboggs_gitlab> > Except it's a mess ⏎ ⏎ lol I was thinking that might happen 😆
<FromGitter>
<dscottboggs_gitlab> rkeene, I have not, should I?
<FromGitter>
<j8r> How can I do for a type restriction then?
<FromGitter>
<dscottboggs_gitlab> wait, isn't TCL a dynamic scripting language?
<rkeene>
dscottboggs, Maybe
<rkeene>
:-D
<oprypin>
V's source code seems to match my expectations of code style somehow
<rkeene>
Tcl is the most dynamic scripting language
<FromGitter>
<dscottboggs_gitlab> @j8r a type restriction to `Exception` or to `Exception+`?
<oprypin>
but doesnt Tcl have a compiler?
<FromGitter>
<j8r> @dscottboggs_gitlab for `Exception+`
<rkeene>
oprypin, Yes, you can compile it AOT... it's still a work in progress
<oprypin>
cool
<FromGitter>
<dscottboggs_gitlab> @j8r I don't think you can..
<FromGitter>
<dscottboggs_gitlab> I think you have to use `Exception`
<rkeene>
It's pretty impressive since it's more dynamic than JavaScript and AOT compiling JavaScript isn't that popular
<FromGitter>
<dscottboggs_gitlab> hm, I'm big on type restrictions so I'm not sure if it's for me, rkeene
<oprypin>
dscottboggs_gitlab, u say "have to" as if it's somehow a bad thing
<oprypin>
j8r, this `+` is not a real part of the language specification, just some undesirable property of the current implementation. it pops up whenever the compiler suboptimally merges two different subclasses into their base class. but it's never a valid syntax and you shouldn't care about it
<FromGitter>
<dscottboggs_gitlab> haha not how I meant it, it piqued my interest
<FromGitter>
<dscottboggs_gitlab> yeah I was thinking it was something like that, thanks oprypin
<rkeene>
dscottboggs, Nothing stops you from restricting types in Tcl
<FromGitter>
<dscottboggs_gitlab> hm
<rkeene>
Tcl is so flexible you can build pretty much any language you want out of it
<FromGitter>
<dscottboggs_gitlab> I guess that's two more languages I need to research this week, V and TCL
<FromGitter>
<watzon> The tcl website makes me sad
<oprypin>
nobody has said so far that tcl is actually a good language
<oprypin>
tried to skip the intermediate replies but it's weird then
<oprypin>
yeah the issues are a gold mine, realized i shouldnt bother posting links to particular issues
<FromGitter>
<dscottboggs_gitlab> TBF it makes sense there would be a lot of little bugs and configuration issues like this. Those comments are just really funny.
<FromGitter>
<dscottboggs_gitlab> no but really what is this (https://github.com/vlang/v/blob/96e15b0f0fd9549783e2c0b3c259d959e0477593/compiler/main.v#L809-L811) supposed to be...? `v` is mutable because `.compile()`mutates it....but then the changes are ignored and something happens on an aribtrary file? It looks like multiple REPLs running in parallel will have a race condition on that file
<oprypin>
dscottboggs_gitlab, well hey, `crystal eval` has a race condition sooooo
<FromGitter>
<dscottboggs_gitlab> oof.
<FromGitter>
<dscottboggs_gitlab> ... dare I ask why?
<oprypin>
well it has basically this same logic in it
<oprypin>
write to hardcoded file path and run it
<FromGitter>
<dscottboggs_gitlab> ...but...our stdlib includes `File.tempfile`?
<FromGitter>
<dscottboggs_gitlab> and that's like...a part of glibc, so v could call it too
<FromGitter>
<j8r> Does V use LLVM? ⏎ ⏎ > No. V compiles directly to machine code. It's one of the main reasons it's so light and fast. Right now only x64 architecture/Mach-O format are supported. Once V is open-sourced, other architectures and formats should be implemented relatively quickly.
<alex``>
what is the use of require "foo" looking in "foo/foo.cr" ?
<alex``>
do you use it?
moei has quit [Quit: Leaving...]
<FromGitter>
<dscottboggs_gitlab> I didn't know that was a thing
<FromGitter>
<dscottboggs_gitlab> Is there any way around this aside from making sure the exception gets raised before JSON.build is called? https://carc.in/#/r/73u2
<FromGitter>
<watzon> Now it's time to work on the AST
<woodruffw>
oprypin & @dscotboggs_gitlab: thanks for the tips. yeah, i'm receiving an already allocated pointer from a `fun`, and `LibC.free` works, was just wondering if there was something cleaner i was missing ;)
<woodruffw>
unfortunately i can't make direct use of `finalize` here, since it's not really adding any classes: i'm writing bindings for libCBOR, which should have an almost identical API to the current `JSON.mapping`/`YAML.mapping`