How to use the aws-amplify.Logger function in aws-amplify

To help you get started, we’ve selected a few aws-amplify examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ionic-team / starters / ionic-angular / official / aws / src / pages / confirmSignIn / confirmSignIn.ts View on Github external
import { Component } from '@angular/core';

import { NavController, NavParams } from 'ionic-angular';
import { Auth, Logger } from 'aws-amplify';

import { TabsPage } from '../tabs/tabs';
import { LoginPage } from '../login/login';

const logger = new Logger('ConfirmSignIn');

@Component({
  selector: 'page-confirm-signin',
  templateUrl: 'confirmSignIn.html'
})
export class ConfirmSignInPage {
  
  public code: string;
  public user: any;

  constructor(public navCtrl: NavController, public navParams: NavParams) {
    this.user = navParams.get('user');
  }

  confirm() {
    Auth.confirmSignIn(this.user, this.code, null)
github aws-amplify / amplify-js / packages / aws-amplify-react-native / dist / Auth / ConfirmSignIn.js View on Github external
*
 *     http://aws.amazon.com/apache2.0/
 *
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */

import React from 'react';
import { View, Text, TextInput, Button } from 'react-native';
import { Auth, I18n, Logger } from 'aws-amplify';
import AmplifyTheme from '../AmplifyTheme';
import { ConfirmationCode, LinkCell, Header, ErrorRow } from '../AmplifyUI';
import AuthPiece from './AuthPiece';

const logger = new Logger('SignIn');

const Footer = props => {
    const theme = props.theme || AmplifyTheme;
    return React.createElement(
        View,
        { style: theme.sectionFooter },
        React.createElement(
            LinkCell,
            { theme: theme, onPress: () => onStateChange('signIn') },
            I18n.get('Back to Sign In')
        )
    );
};

export default class ConfirmSignIn extends AuthPiece {
    constructor(props) {
github aws-amplify / amplify-js / packages / aws-amplify-react / dist / Auth / Greetings.js View on Github external
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /*
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * the License. A copy of the License is located at
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                *     http://aws.amazon.com/apache2.0/
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * and limitations under the License.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                */

var logger = new _awsAmplify.Logger('Greetings');

var Greetings = function (_AuthPiece) {
    _inherits(Greetings, _AuthPiece);

    function Greetings(props) {
        _classCallCheck(this, Greetings);

        var _this = _possibleConstructorReturn(this, (Greetings.__proto__ || Object.getPrototypeOf(Greetings)).call(this, props));

        _this.signOut = _this.signOut.bind(_this);
        _this.googleSignOut = _this.googleSignOut.bind(_this);
        _this.facebookSignOut = _this.facebookSignOut.bind(_this);
        _this.checkUser = _this.checkUser.bind(_this);
        _this.onHubCapsule = _this.onHubCapsule.bind(_this);

        _this.state = {
github aws-amplify / amplify-js / packages / aws-amplify-react-native / src / Auth / SignUp.js View on Github external
import {
	FormField,
	PhoneField,
	LinkCell,
	Header,
	ErrorRow,
	AmplifyButton,
} from '../AmplifyUI';
import AuthPiece from './AuthPiece';
import countryDialCodes from '../CountryDialCodes';
import signUpWithUsernameFields, {
	signUpWithEmailFields,
	signUpWithPhoneNumberFields,
} from './common/default-sign-up-fields';

const logger = new Logger('SignUp');
export default class SignUp extends AuthPiece {
	constructor(props) {
		super(props);

		this._validAuthStates = ['signUp'];
		this.state = {};
		this.signUp = this.signUp.bind(this);
		this.sortFields = this.sortFields.bind(this);
		this.getDefaultDialCode = this.getDefaultDialCode.bind(this);
		this.checkCustomSignUpFields = this.checkCustomSignUpFields.bind(this);
		this.needPrefix = this.needPrefix.bind(this);
		this.header =
			this.props && this.props.signUpConfig && this.props.signUpConfig.header
				? this.props.signUpConfig.header
				: 'Create a new account';
github richardzcode / Journal-AWS-Amplify-Tutorial / step-08 / journal / src / components / ConfirmRegisterForm.js View on Github external
import React from 'react'
import { Button, Form, Grid, Header, Message, Segment } from 'semantic-ui-react'

import { Auth, Logger } from 'aws-amplify';
import { AuthPiece } from 'aws-amplify-react';

const logger = new Logger('ConfirmRegisterForm');

class ConfirmRegisterForm extends AuthPiece {
    constructor(props) {
        super(props);

        this.confirm = this.confirm.bind(this);
        this.resend = this.resend.bind(this);
    }

    confirm() {
        const username = this.usernameFromAuthData() || this.inputs.username;
        const { code } = this.inputs;
        logger.debug('username: ' + username);
        Auth.confirmSignUp(username, code)
            .then(data => this.changeState('signIn', data))
            .catch(err => this.error(err));
github aws-amplify / amplify-js / packages / aws-amplify-react-native / src / Auth / SignIn.js View on Github external
* and limitations under the License.
 */

import React from 'react';
import { View, TouchableWithoutFeedback, Keyboard } from 'react-native';
import { Auth, I18n, Logger, JS } from 'aws-amplify';
import AuthPiece from './AuthPiece';
import {
	AmplifyButton,
	FormField,
	LinkCell,
	Header,
	ErrorRow,
} from '../AmplifyUI';

const logger = new Logger('SignIn');

export default class SignIn extends AuthPiece {
	constructor(props) {
		super(props);

		this._validAuthStates = ['signIn', 'signedOut', 'signedUp'];
		this.state = {
			username: null,
			password: null,
			error: null,
		};

		this.checkContact = this.checkContact.bind(this);
		this.signIn = this.signIn.bind(this);
	}
github aws-amplify / amplify-js / packages / aws-amplify-react / dist / Widget / MFASetupComp.js View on Github external
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /*
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * the License. A copy of the License is located at
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                *     http://aws.amazon.com/apache2.0/
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * and limitations under the License.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                */

var logger = new _awsAmplify.Logger('MFASetupComp');

var MFASetupComp = function (_Component) {
    _inherits(MFASetupComp, _Component);

    function MFASetupComp(props) {
        _classCallCheck(this, MFASetupComp);

        var _this = _possibleConstructorReturn(this, (MFASetupComp.__proto__ || Object.getPrototypeOf(MFASetupComp)).call(this, props));

        _this.setup = _this.setup.bind(_this);
        _this.showSecretCode = _this.showSecretCode.bind(_this);
        _this.verifyTotpToken = _this.verifyTotpToken.bind(_this);
        _this.handleInputChange = _this.handleInputChange.bind(_this);

        _this.state = {
            code: null,
github ionic-team / starters / ionic-angular / official / aws / src / pages / tasks / tasks.ts View on Github external
import { Component } from '@angular/core';

import { NavController, ModalController } from 'ionic-angular';
import { Auth, Logger } from 'aws-amplify';

import { TasksCreatePage } from '../tasks-create/tasks-create';
const aws_exports = require('../../aws-exports').default;

import { DynamoDB } from '../../providers/providers';

const logger = new Logger('Tasks');

@Component({
  selector: 'page-tasks',
  templateUrl: 'tasks.html'
})
export class TasksPage {

  public items: any;
  public refresher: any;
  private taskTable: string = aws_exports.aws_resource_name_prefix + '-tasks';
  private userId: string;

  constructor(public navCtrl: NavController,
              public modalCtrl: ModalController,
              public db: DynamoDB) {
github richardzcode / Journal-AWS-Amplify-Tutorial / step-07 / journal / src / modules / Home.jsx View on Github external
import React, { Component } from 'react';
import { Container, Segment, Header, Form, Menu, Dropdown } from 'semantic-ui-react';

import { Auth, Storage, Logger } from 'aws-amplify';
import { S3Album, S3Text } from 'aws-amplify-react';

const today = () => {
    const dt = new Date();
    return dt.getFullYear() + '-' + (dt.getMonth() + 1) + '-' + dt.getDate();
}

const logger = new Logger('Home');

export default class Home extends Component {
    constructor(props) {
        super(props);

        this.handleChange = this.handleChange.bind(this);
        this.handleDateChange = this.handleDateChange.bind(this);
        this.save = this.save.bind(this);
        this.extractDates = this.extractDates.bind(this);
        this.translateItem = this.translateItem.bind(this);

        this.state = {
            ts: new Date().getTime(),
            date: today(),
            dates: []
        };