function fetchLogsAsync(context) {
    return new Promise((resolve, reject) => {
        debug('fetchLogsAsync', context.url);
        context.kube.log(context.url)
            .then(data => {
                if (data) {
                    //split string into array of lines
                    context.body = [];
                    data.split('\n').forEach(line => {
                        if (line) context.body.push(line + '\n');
                    });
                    context.success = true;
                    resolve(context);
                }
            })
            .catch(err => {
                let newErr = new Error(`error fetching container logs from k8s: ${err.message}`);
                console.error(newErr)
                context.err = newErr;
                reject(newErr);
            });
    });
}
//returns a promise that fetches logs, process results, and updates the context.body
returns a promise that fetches logs, process results, and updates the context.body
returns a promise that fetches logs process results and updates the context . body
function fetchLogsAsync(context) {
    return new Promise((resolve, reject) => {
        debug('fetchLogsAsync', context.url);
        context.kube.log(context.url)
            .then(data => {
                if (data) {
                    context.body = [];
                    data.split('\n').forEach(line => {
                        if (line) context.body.push(line + '\n');
                    });
                    context.success = true;
                    resolve(context);
                }
            })
            .catch(err => {
                let newErr = new Error(`error fetching container logs from k8s: ${err.message}`);
                console.error(newErr)
                context.err = newErr;
                reject(newErr);
            });
    });
}
function fetchLogsAsync ( context ) { return new Promise ( ( resolve , reject ) => { debug ( 'fetchLogsAsync' , context . url ) ; context . kube . log ( context . url ) . then ( data => { if ( data ) { context . body = [ ] ; data . split ( '\n' ) . forEach ( line => { if ( line ) context . body . push ( line + '\n' ) ; } ) ; context . success = true ; resolve ( context ) ; } } ) . catch ( err => { let newErr = new Error ( ` ${ err . message } ` ) ; console . error ( newErr ) context . err = newErr ; reject ( newErr ) ; } ) ; } ) ; }
returns a promise that fetches logs, process results, and updates the context.body
returns a promise that fetches logs process results and updates the context . body
//split string into array of lines