Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide access to the check log when using checker as a library #17

Open
nuest opened this issue Jan 24, 2018 · 2 comments
Open

Provide access to the check log when using checker as a library #17

nuest opened this issue Jan 24, 2018 · 2 comments

Comments

@nuest
Copy link
Member

nuest commented Jan 24, 2018

In the log I can see

index:requestHandling Differences were found; Calling compareHTML to create a HTML file highlighting these differences. +0ms
  checker:slice Extracting text chunks from original HTML String and saving them for later. +6ms
  checker:general Successfully read files. +2ms
  checker:slice Sliced up those pesky Stringsens. +5ms
  checker:slice Original:  1 images, 2 chunks of text. +1ms
  checker:slice Reproduced: 1 images, 2 chunks of text. +0ms
  checker:slice Created Buffer for Reproduced image #0: 17560 +0ms
  checker:slice Created Buffer for Reproduced image #0: 17639 +1ms
  checker:slice All images were extracted successfully. +0ms
  checker:compare Begin comparing images. +0ms
  checker:compare Original 0: {"width":1344,"height":960,"type":"png"} +1ms
  checker:compare Reproduced 0: {"width":1344,"height":960,"type":"png"} +0ms
  checker:compare No resizing needed for images with index 0 +1ms
  checker:general Preparation is done, move on to visual comparison. +0ms
  checker:compare Starting visual comparison of 1 images. +0ms
  checker:compare Creating a diff-Image for images with index 0 +1ms
  checker:compare Visual Comparison completed. +978ms
  checker:reassemble Begin Reassembling HTML with Diff-Images where images were not equal. +0ms
  checker:reassemble Piecing together text chunks and images. +0ms
  checker:reassemble Reassembly done. +7ms
  index:requestHandling Check done. +0ms
  index:requestHandling Metadata JSON file written successfully +61ms
  index:requestHandling Diff-HTML file written successfully +25m

And the resolved object is (excerpt):

{ checkSuccessful: false,
  images: 
   [ { imageIndex: 0,
       resizeOperationCode: 0,
       compareResults: [Object] } ],
  display: 
   { diff: '<!DOCTYPE html>\n\n<html xmlns="http://www.w3.org/1999/xhtml">\n\n<head>\n\n<meta charset="utf-8" />\n<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\n<meta name="generator" content="pandoc" />\n\n\n\n<meta name="date" content="2017-01-01" />\n\n<title>Capacity of container ships in seaborne trade from 1980 to 2016 (in million dwt)*</title>\n\n<script src="data:application/x-javascript;base64,LyohIGpRdWVyeSB2MS4xMS4zIHwgKGMpIDIwMDUsIDIwMTUgalF1ZXJ5IEZvdW5kYXRpb24sIEluYy4gfCBqcXVlcnkub3JnL2xpY2Vuc2UgKi8KIWZ1bmN0aW9uKGEsYil7Im9iamVjdCI9PXR5cGVvZiBtb2R1bGUmJiJvYmplY3QiPT10eXBlb2YgbW9kdWxlLmV4cG9ydHM/bW9kdWxlLmV4cG9ydHM9YS5kb2N1bWVudD9iKGEsITApOmZ1bmN0aW9uKGEpe2lmKCFhLmRvY3VtZW50KXRocm93IG5ldyBFcnJvcigialF1ZXJ5IHJlcXVpcmVzIGEgd2luZG93IHdpdGggYSBkb2N1bWVudCIpO3JldHVybiBiKGEpfTpiKGEpfSgidW5kZWZpbmVkIiE9dHlwZW9mIHdpbmRvdz93aW5kb3c6dGhpcyxmdW5jdGlvbihhLGIpe3ZhciBjPVtdLGQ9Yy5zbGljZSxlPWMuY29uY2F0LGY9Yy5wdXNoLGc9Yy5pbmRleE9mLGg9e30saT1oLnRvU3RyaW5nLGo9aC5oYXNPd2
[...]

Ideally, a stream of the check log should be made available. Is this is too complex, then the full log should be included in the resolved object.

@nuest
Copy link
Member Author

nuest commented Jan 31, 2018

Maybe redirect the logger to our own stream (see https://www.npmjs.com/package/debug#output-streams) and then split all log messages within that stream to go to standard output of debug and own stream, possibly using though2 for some nice piping (https://www.npmjs.com/package/through2)

@nuest
Copy link
Member Author

nuest commented Jun 25, 2018

First step: make full log available in resolved object.

Later: make log available as stream.

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

No branches or pull requests

1 participant