Skip to content
This repository has been archived by the owner on Apr 20, 2023. It is now read-only.

Transformer logger use #21

Closed
m4olivei opened this issue Apr 10, 2016 · 3 comments
Closed

Transformer logger use #21

m4olivei opened this issue Apr 10, 2016 · 3 comments

Comments

@m4olivei
Copy link
Contributor

The use of the logger in the Transformer code can be awkward when appenders are used that list in reverse chronological order. Or even just when each call to $log->debug() is stored in the database as a separate record rather then in a flat file. For example, we are using the Instant Articles SDK in a Drupal module here https://github.com/BurdaMagazinOrg/module-fb_instant_articles and the logs come out like this:

http://take.ms/y59qK

Could we instead build up the whole message as a string using newlines, before calling $log->debug with the entire message?

https://github.com/facebook/facebook-instant-articles-sdk-php/blob/master/src/Facebook/InstantArticles/Transformer/Rules/Rule.php#L20,L25

@m4olivei m4olivei changed the title Transformer logger Transformer logger use Apr 10, 2016
@simonengelhardt simonengelhardt self-assigned this Apr 10, 2016
@simonengelhardt
Copy link
Contributor

Thanks for flagging this @m4olivei. We could consider implementing a custom renderer, but I think just concatenating the message with newlines as you suggest is probably a simpler and better approach. We'll look into it.

@everton-rosario
Copy link
Contributor

Im considering to have a better log on the Transformation process.
Like we have today "warnings" stored under the Transformer object, we can have the step-by-step log there, and we can flush it as we finish to process the file.

Something like:

    // processing and transforming code
    $transformer->appendLog($message)

    // after transformation ends
    $logger->debug($transformer->getFormattedLog());

@everton-rosario
Copy link
Contributor

PR #304 for this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants