title: Write log from Jenkinsfile
body: <p>When creating Jenkins pipelines or libraries which should be used in a pipeline it's often hard to debug code with the logging options provided. At the moment I'm logging with this:</p>
  
  <pre><code>node {
    ...
    sh "echo ${thingtoshow}"
  }
  </code></pre>
  
  <p>The downside is that this it's not very powerful when it comes to Groovy/Java specific details - e.g. it wouldn't allow me to dump the contents of objects right away</p>
  
  <p>It creates a mess in the actual logs:</p>
  
  <pre><code>[Pipeline] sh
  [workspace] Running shell script
  + echo 'things'
  things
  </code></pre>
  
  <p>So how could I write logs to just get a single line of log output within the Jenkins console?</p>
  
  <hr>
  
  <p>Edit: Even though the code example doesn't show it, but this is particularly useful when developing shared <a href="https://jenkins.io/doc/book/pipeline/shared-libraries/" rel="noreferrer">Groovy libraries</a> for Jenkins pipelines</p>