The SetLogHandler method of Eyes activates the trace logs of Applitools Eyes SDK. Please find below an example of the syntax of this method in each of the languages. Note that this syntax writes the logs to the standard output.
If you want finer control on how the logs are processed, you can provide your own LogHandler implementation instead of StdoutLogHandler.
Java:
Print logs to console:
eyes.setLogHandler(new StdoutLogHandler(true));
Export logs to file:
eyes.setLogHandler(new FileLogger("path/to/file.log",true,true));
.Net:
Print logs to console:
eyes.SetLogHandler(new StdoutLogHandler(true));
eyes.SetLogHandler(new FileLogHandler("path/to/file.log",true,true));
Python: Print logs to console:
from applitools.common import logger, StdoutLogger
import logging
logger.set_logger(StdoutLogger(level=logging.DEBUG))
Export logs to file:
from applitools.common import logger, FileLogger
logger.set_logger(FileLogger("path/to/file.log"))
Ruby:Print logs to console:
require 'logger'
eyes.log_handler = Logger.new(STDOUT)
Export logs to file:
eyes.log_handler = Logger.new('path/to/logfile.log')
JavaScript-Selenium:
Print logs to console:
var ConsoleLogHandler = require('eyes.selenium').ConsoleLogHandler;
eyes.setLogHandler(new ConsoleLogHandler(true));
Export logs to file:
var FileLogHandler = require('eyes.selenium').FileLogHandler;
eyes.setLogHandler(new FileLogHandler(true));
Note: The eyes.log file will appear under the root folder.
WebdriverIO 4 & 5:
Print logs to console:
const { ConsoleLogHandler } = require ('@applitools/eyes-sdk-core')
eyes.setLogHandler(new ConsoleLogHandler(true));
Export logs to file:
var { FileLogHandler } = require('@applitools/eyes-sdk-core');
eyes.setLogHandler(new FileLogHandler(true));
Note: The eyes.log file will appear under the root folder.
WebdriverIO 5 Service:
In wdio config file, add:
beforeSession: function (config, capabilities, specs) {
config.enableEyesLogs = true;
},
Espresso:
Print logs to Logcat:
import com.applitools.eyes.android.common.logger.LogHandler;
import com.applitools.eyes.android.common.logger.StdoutLogHandler;
LogHandler mLogHandler = new StdoutLogHandler(true);
eyes.setLogHandler(mLogHandler);
UFT:
Export logs to a file (add this before eyes.open):
eyes.LogFile = "eyes.log"
Storybook:
Export logs to a file (run this from the terminal/Console to start the test with logs):
Mac:
APPLITOOLS_SHOW_LOGS=true npx eyes-storybook >file.log
Windows:
set APPLITOOLS_SHOW_LOGS=true
npx eyes-storybook >file.log
Cypress:
Export logs to a file (run this from the terminal/Console to start the test with logs):
APPLITOOLS_SHOW_LOGS=true npx cypress open >file.log
testCafe:
In the applitools.config.js file add:
showLogs: true
PHP:
Print logs to console:
$eyes->setLogHandler(new PrintLogHandler(true));
Export logs to file:
$eyes->setLogHandler(new FileLogger("path/to/logfile.log", true, true));