HomePhorge

(PUP-4201) Add support for structured logging
45e3f41a38f7Unpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

(PUP-4201) Add support for structured logging

The main objective for this commit is to retain backward compatility
with the 3.x stream. It only touches the logged messages that stems
from the Puppet::Pops::IssueReporter.

The commit removes the responsibility for formatting the log messages
from the IssueReporter. Instead it passes all details to the Log
instance that is created, either by direct logging och by raising an
error. A new class named ParseErrorWithIssue (a subclass of ParseError)
that keeps track of the basic message and the issue_code was needed to
accomplish this. This class is also has the attributes 'environment'
and 'node' that will be assigned in rescue blocks before the exception
is re-thrown. Prior to this change, the rescue block would create a
new error instance with additional information in the actual message
but loose the detailed information.

The 'file' log destination was altered slightly so that if the path
ends with '.json', it will output each Log entry in JSON format. The
list of entries will be prefixed by a '[' (added when the file is
first created) and delimited with ','. The file will contain almost
valid JSON at all times but the last ']' will be missing.

Details

Provenance
Thomas Hallgren <thomas@tada.se>Authored on
vanmeeuwenPushed on Jun 2 2015, 2:22 PM
Parents
rPUaf6d0f5083e0: (PUP-4133) Backport tests from master for illegal name
Branches
Unknown
Tags
Unknown

Event Timeline

Thomas Hallgren <thomas@tada.se> committed rPU45e3f41a38f7: (PUP-4201) Add support for structured logging (authored by Thomas Hallgren <thomas@tada.se>).Mar 23 2015, 10:36 AM