Live data from Hacker News

‘Woof’, a pure Scala 3 logging library

medium.com

21–30 of 50 posts

Re: ‘Woof’, a pure Scala 3 logging library

#21
Can someone please explain the purpose of a logging library (woof, log4j, etc)? There must be something beyond writing text to an external file, possibly with different error levels, that I'm missing. This is a serious question. I truly do not understand what you gain by depending on an external library for this (seemingly) simple operation and would appreciate some insight. Thanks!

Re: ‘Woof’, a pure Scala 3 logging library

#22

Can someone please explain the purpose of a logging library (woof, log4j, etc)? There must be something beyond writing text to an external file, possibly with different error levels, that I'm missing. This is a serious question. I truly do not understand what you gain by depending on an external library for this (seemingly) simple operation and would appreciate some insight. Thanks!

I was wondering the same, but a recent explanation made sense to me. The idea is to have the ability to control logging of third-party libraries. You might want to see some log messages but you don't want everything spamming stuff into stdout.

Re: ‘Woof’, a pure Scala 3 logging library

#23

Can someone please explain the purpose of a logging library (woof, log4j, etc)? There must be something beyond writing text to an external file, possibly with different error levels, that I'm missing. This is a serious question. I truly do not understand what you gain by depending on an external library for this (seemingly) simple operation and would appreciate some insight. Thanks!

Often logging libraries allow you changing the logging level at runtime, without restarting or recompiling the application, as well as turning logs or off at runtime for different parts of the application. They let you organize logging levels so that when, for example, you turn the level to INFO in one part of the applications, all of the connected code also gets its own log level turned to INFO and you can define which parts of the application should change their log levels in sync. There's also performance considerations, often log libraries claim to implement tricks so that logging is supposed to be faster than naively writing strings to a file.

Re: ‘Woof’, a pure Scala 3 logging library

#24
post #9

Earlier quoted context omitted.

Where did you read "category theory" in that article? I'm not familiar with Woof but it looks like an attempt at writing a pure logging lib. What is wrong with that?

the so called "purity" is achieved by using a higher kinded type and the cats IO monad. it's like adding "1+1" with a "mathematical-calculation-monoid-combine-factory-builder-singleton-locator-evaluator-pattern". I remember keeping it simple as an ultimate goal but maybe I am just too for this FP peeing contest? why is it such a frickin' deal to log a message somewhere?

> why is it such a frickin' deal to log a message somewhere?

Need I remind you of the Log4J debacle? It's definitely a big deal.

Whether this is the right approach is another matter.

PS: trust me, you don't need to read on category theory to use or understand monoids, which at the level they are used in Scala and Haskell code, they are trivial to understand.

Re: ‘Woof’, a pure Scala 3 logging library

#25
I have done Scala for a long time, I had a chance encounter with Spring boot and reflections like no tomorrow style of programming. It was like a wake up call. I knew why I hated the complex juggernaut of the configs and magic but man do I hate to admit, how productive I was once all that was working. Sure someday it would not work and I would need to debug in my IDE but that was rare.

I have lived the life of somebody who wants to have every effect annotated, still on some level I believe maybe it can be achieved someday with ergonomics. I have done a lot of rust now and when I look back, I look differently at monads and those abstractions now. Maybe I felt smart using them.

There is some value in being able to just look at any library and being able to understand what and how. I have done this a lot in Rust. Scala has some amazing libs and I can't deny that they were immensely powerful, it wasn't easy to make sense of it all though, forget about tweaking and making changes easily.

All in all I have come to realise, there is no perfect paradigm, get work done. Use what makes sense. So stop fretting over dart/go, don't bemoan Kotlin, use Scala when you can and don't worry about making everything a kliesli. And really I would not worry about my logger having a side effect. Effect systems still sound cool though, maybe someday.

Not worrying about programming languages and code golfing has made me a much better and productive developer, I think.

Re: ‘Woof’, a pure Scala 3 logging library

#26
post #18
post #9

Earlier quoted context omitted.

Where did you read "category theory" in that article? I'm not familiar with Woof but it looks like an attempt at writing a pure logging lib. What is wrong with that?

It's using IO monads

But it doesn't need to. The overall solution, I mean. See another comment in this section mentioning they follow a similar approach but NOT using the IO monad.

Also: you don't need to know category theory to use the IO monad.

Re: ‘Woof’, a pure Scala 3 logging library

#27
post #19

Earlier quoted context omitted.

the so called "purity" is achieved by using a higher kinded type and the cats IO monad. it's like adding "1+1" with a "mathematical-calculation-monoid-combine-factory-builder-singleton-locator-evaluator-pattern". I remember keeping it simple as an ultimate goal but maybe I am just too for this FP peeing contest? why is it such a frickin' deal to log a message somewhere?

> I remember keeping it simple as an ultimate goal but maybe I am just too for this FP peeing contest? why is it such a frickin' deal to log a message somewhere? Don't know about others but for me it is about being able to easily verify that my logging is setup correctly. Once you write your logging to some monad (the library we use does not require it to be IO) testing it becomes trivial with a WriterT monad where i…

Why would I verify logging which itself is a verification instrument? And, seriously, how hard is it to emit a diagnostic message so I need a test for that to get it right?

Re: ‘Woof’, a pure Scala 3 logging library

#28
post #7

Having been primarily a Scala dev for the last 12 years I feel like people have slowly lost their minds over what pragmatic FP in Scala should be. People are willingly recreating the Java situation of 'I don't know the project yet but I know we need Spring!' with these ridiculous libraries from Haskell zealots for no obvious benefit. The ergonomics of this lib out of the box are literally worse for no reason, and wor…

As an observer of this exact phenomenon, I suggest that it is due to the culture that comes with scala. In any given scala-centric organization, there's going to eventually be someone who has mastered the art of talking High Scala. Unless there is someone equally skilled on both dimensions (persuasion and SW eng), and unfortunately, someone approximately as senior, then there is an interative game where added abstrac…

I'm at one of such organisations and you have concisely described the situation.

Re: ‘Woof’, a pure Scala 3 logging library

#29
post #19

Earlier quoted context omitted.

> I remember keeping it simple as an ultimate goal but maybe I am just too for this FP peeing contest? why is it such a frickin' deal to log a message somewhere? Don't know about others but for me it is about being able to easily verify that my logging is setup correctly. Once you write your logging to some monad (the library we use does not require it to be IO) testing it becomes trivial with a WriterT monad where i…

Why would I verify logging which itself is a verification instrument? And, seriously, how hard is it to emit a diagnostic message so I need a test for that to get it right?

If you have some rare (rare as in it happens once every few months or something like that) error and you need logging about it. Also testing it ensures nobody by mistake removes that bit of logging by accident.

Re: ‘Woof’, a pure Scala 3 logging library

#30
post #7

Having been primarily a Scala dev for the last 12 years I feel like people have slowly lost their minds over what pragmatic FP in Scala should be. People are willingly recreating the Java situation of 'I don't know the project yet but I know we need Spring!' with these ridiculous libraries from Haskell zealots for no obvious benefit. The ergonomics of this lib out of the box are literally worse for no reason, and wor…

This problem with the scala community exists because it is composed of two different philosophical schools of thought. There's the ML camp, which is where we get all of the awesome pragmatic features of the ML family of languages (Martin Odersky has been very clear that Scala is philosophically an ML-family language). And then we get the Haskell camp, which rightly determined that the Haskell ecosystem was terrible.…

Add to it the disease that all guest languages suffer from creating idiomatic wrappers instead of just directly calling into the rich ecosystem of the existing platform.
Post reply on HN