Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Li Haoyi
    @lihaoyi
    because pprint.pprintln without importing anything certainly still works just fine :D
    Alan Johnson
    @acjay
    what about pprint.stringify?
    i guess to give a concrete thing i'm trying to figure out, i used to have this function, which i used for diagnostics:
    object NewLoggerOps {
      def printVar[V: pprint.PPrint.PPrint](value: sourcecode.Text[V]) = {
        println(s"${value.source}: ${pprint.stringify(value.value)}")
      }
    }
    i cant figure out how to get this to compile in 0.5.x
    Li Haoyi
    @lihaoyi
    i think stringify became porint.apply
    Alan Johnson
    @acjay
    yeah, that's what the docs say, but that doesn't compile for me
    Li Haoyi
    @lihaoyi
    "doesnt compile" is the least thing you could tell me if you want me to help :p
    Alan Johnson
    @acjay
    sorry, was scrolling back to get the error
    [error] /Users/alan/projects/causality/src/main/scala/net/artsy/auction/lib/NewLoggerOps.scala:8: package pprint is not a value
    [error]     pprint(value.value)
    [error]     ^
    Li Haoyi
    @lihaoyi
    you need to explicitly pprint.apply, just pprint( doesnt work i think
    Alan Johnson
    @acjay
    oh interesting. Scala quirk
    Li Haoyi
    @lihaoyi
    yeah it's a scala thing
    Alan Johnson
    @acjay
    i think explictly calling apply and dropping my context bounds is doing the trick. errors are disappearing. thanks so much!
    and thanks for writing badass libraries. having pprint and sourcecode let me make this printVar utility, which takes a lot of the drudgery out of debugging
    Li Haoyi
    @lihaoyi
    yeah it's pretty great isn't it
    go tell your friends :)
    or chip in a bit of support https://www.patreon.com/lihaoyi
    Alan Johnson
    @acjay
    will do!
    good news: an 0.4.3 issue i had reported a couple days ago is fixed. the upgrade was worth it
    lihaoyi/upickle-pprint#204
    Srepfler Srdan
    @schrepfler
    is there any way we could get pretty printing of case classes where we see things more like a key:value (or key=value) pair?
    Guillaume Massé
    @MasseGuillaume
    Not yet. Put there is a pr in Scala 2.13 that will allow this built in.
    Srepfler Srdan
    @schrepfler
    Sweet, I think I saw some comment about that
    Wojtek Pituła
    @Krever
    Hey, is there an easy way to have field names when printing case classes?
    Srepfler Srdan
    @schrepfler
    that would be awesome, splunk for example indexes very easily stuff which are printed with the key=value convention
    I think there’s a logging style which recomends this more than logging to json as some people are advocating for structured logging but I can’t find a reference
    http://dev.splunk.com/view/logging/SP-CAAAFCK
    https://brandur.org/logfmt
    at=info method=GET path=/ host=mutelight.org fwd="124.133.52.161"
      dyno=web.2 connect=4ms service=8ms status=200 bytes=1653
    it would be really awesome to have something like that automatically pretty print case classes
    Srepfler Srdan
    @schrepfler
    let's see what this Scala 2.13 brings on the table
    Li Haoyi
    @lihaoyi
    if you want json logging, use upickle
    can do binary msgpack logging as well :)
    Srepfler Srdan
    @schrepfler
    lol
    let’s write direct to parquet then
    :D
    Li Haoyi
    @lihaoyi
    sure why not
    or Arrow
    just need to write a upickle visitor
    Srepfler Srdan
    @schrepfler
    that would be interesting, use big data tools to analyse logs directly
    and it would cost you less if you ship them around both in disk and network
    though I suppose everybody gzips the text anyhow
    Frank P. Tominc
    @franktominc
    I'm having a problem somewhere in the toolchain, not sure where. If I add only the pprint dependency I got some NoClassDef exceptions saying it couldn't find scala-reflect. Not really hard to fix, but it's annoying. Is there a way to make it a transitive dependency, so I don't need to add it manually on the build.sbt?
    Mark Moore
    @MarkRBM
    would we expect pprint to cut off output and add an ellipsis when being used with ammonite in a .sc file ?
    I don’t think its my shell truncating the output, if its pprint, is there a way for me to turn off truncation?
    sorry I see in the docs now that truncation is talked about a good bit, trying to find how to turn it off
    Li Haoyi
    @lihaoyi
    height = 99999
    Dermot Haughey
    @hderms
    curious if it would make sense to be able to turn that off wholesale or if there is some technical reason it's difficult
    I was just about to come in here to ask the same question as @MarkRBM
    Li Haoyi
    @lihaoyi
    no reason
    feel free to send a PR to make -1 disable truncation
    Dermot Haughey
    @hderms
    cool i'll look into doing it