AWS Amplify writes logs through Logger.
Create a logger
import { Logger } from 'aws-amplify';
const logger = new Logger('foo');
logger.info('info bar');
logger.debug('debug bar');
logger.warn('warn bar');
logger.error('error bar');
When error
try {
...
} catch(e) {
logger.error('error happened', e);
}
Log level can be set on logger creation
const logger = new Logger('foo', 'INFO');
logger.debug('callback data', data); // this will not write, unless ...
Global setting overrides logger instance setting
Amplify.Logger.LOG_LEVEL = 'DEBUG';
const logger = new Logger('foo', 'INFO');
logger.debug('callback data', data); // this will write
During web development, you can set global log level in browser console log
window.LOG_LEVEL = 'DEBUG';
Supported log levels:
- ERROR
- WARN
- INFO
- DEBUG
- VERBOSE