appium / appium-doctor

[Deprecated] Please use https://github.com/appium/appium/tree/master/packages/doctor
Apache License 2.0
128 stars 34 forks source link

Add logHandler callback as option to handle logs #95

Closed zcmgyu closed 4 years ago

zcmgyu commented 4 years ago

Description:

When I use appium-doctor in the NodeJS project (not as CLI), I couldn't handle logs without add callback function.

Usage:

function onLogMessage (level, prefix, msg) {
    console.log(level);
    console.log(prefix);
    console.log(msg);
}

configureBinaryLog({ onLogMessage });

Detail Usage in Project:

import { system } from 'appium-support';
import { newDoctor } from 'appium-doctor/build';
import { configureBinaryLog } from 'appium-doctor/build/lib/utils';
import { configure as configurePrompt } from 'appium-doctor/build/lib/prompt';

(()=> {
    function onLogMessage (level, prefix, msg) {
        console.log('DEBUG level', level);
        console.log('DEBUG prefix', prefix);
        console.log('DEBUG prefix', prefix);
    }

    const opts = {
        general: true,
        ios: system.isMac(),
        android: true,
        onLogMessage,
    };

    configurePrompt(opts);
    configureBinaryLog(opts);
    const doctor = newDoctor(opts);

    doctor.run().then(() => {
        console.log('DEBUG doctor.toFix', doctor.toFix);
        console.log('DEBUG doctor.toFixOptionals', doctor.toFixOptionals);
    });
})();
jsf-clabot commented 4 years ago

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Long Nguyen seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.

mykola-mokhnach commented 4 years ago

Could you please describe the purpose of this PR?

KazuCocoa commented 4 years ago

And please sign the CLA. (Please ensure your git email address and the sign email address is the same)

zcmgyu commented 4 years ago

Could you please describe the purpose of this PR?

@mykola-mokhnach I already updated the description above.

And please sign the CLA. (Please ensure your git email address and the sign email address is the same)

@KazuCocoa Sorry, I make a mistake in setting my email address in the commit.

zcmgyu commented 4 years ago

I've just updated usage in the description.

mykola-mokhnach commented 4 years ago

@zcmgyu Please sign the CLA. Make sure the email set for the local github account is the same as was used to sign the CLA

zcmgyu commented 4 years ago

@mykola-mokhnach Sorry again, I'm not familiar with the CLA. I've altered the email address already.

mykola-mokhnach commented 4 years ago

I've altered the email address already.

The bot does not see it. It is necessary to do at least one commit with the email set (or just squash the existing commits)

zcmgyu commented 4 years ago

@mykola-mokhnach I have just squashed current commits with the right email address. Please check.

KazuCocoa commented 4 years ago

appium-doctor@1.15.0