Skip to content
This repository has been archived by the owner on Jun 29, 2019. It is now read-only.

How to debug Plugins? #77

Closed
ishu3101 opened this issue Mar 31, 2016 · 16 comments
Closed

How to debug Plugins? #77

ishu3101 opened this issue Mar 31, 2016 · 16 comments

Comments

@ishu3101
Copy link

How do you debug plugins when you are developing plugins?

@Semigradsky
Copy link
Contributor

I just insert console.log 😄

@ishu3101
Copy link
Author

But then where do you see the console log?

@notatestuser
Copy link
Contributor

Press F12 - it'll open devtools.

@ishu3101
Copy link
Author

Pressing F12 does nothing.

@notatestuser
Copy link
Contributor

Do you have afaaeed?

@ishu3101
Copy link
Author

No was using v0.0.2-rc4, Updated to the latest release which is v0.0.3.

@KennethWussmann
Copy link
Contributor

Better use PluginContext.Logger.log("message"); as mentioned here.

@ishu3101
Copy link
Author

I have noticed that using console.log causes the plugin to break in v0.0.3 but in v0.0.2-rc4 it did not cause any problems

@sethxd
Copy link
Contributor

sethxd commented Mar 31, 2016

I was having this same issue trying to use console.log. Fixed it by including this line just inside module.exports: const logger = pluginContext.logger

And calling it like this: logger.log("Hello world!")

@likerRr
Copy link

likerRr commented Jun 13, 2016

Hey everyone.

Sometimes I face an issue when DevTools shows just Object{} without any properties (except native prototype) for my objects or even null at all (but properties exist and they're accessible). Can't provide an example for the first case, because it doesn't work on simple code, but here is a simple version of the second case (lodash should be installed):

let _ = require('lodash');

module.exports = (context) => {
  return {
    startup() {
      context.logger.log(_); // null
      context.logger.log(_.identity(2)); // 2
    }
  };
};

What's the matter?

@likerRr
Copy link

likerRr commented Jun 16, 2016

@appetizermonster have ideas? ^^^

@appetizermonster
Copy link
Collaborator

There is no advanced way to debug plugins for now. we should make it.
not in docs, but you can use console.log in the plugin if you launch hain on commandline prompt. (but you should remove them in the production)
so it may be helpful for debugging.

@cpriest
Copy link
Member

cpriest commented Nov 13, 2016

I have v0.5.2 which should include afaaeed but F12 does not do anything, F5 does however work which I see that commit also had some code in for. Is F12 expected to be working right now?

@appetizermonster
Copy link
Collaborator

@cpriest I'll take a look at it, thanks for the reporting

@abinadi
Copy link

abinadi commented Dec 13, 2016

I had the same issue as @cpriest. I'm on v0.5.2 and F12 does nothing. Not sure if it is pertinent, but I used the pre-built binary.

DanielFallon added a commit to DanielFallon/hain that referenced this issue Jan 11, 2017
per commit electron/electron@eac2e7c remote needs to be required as require('electron').remote

see discussion here:
electron/electron#3755

should alleviate concerns in this discussion:
hainproject#77
@DanielFallon
Copy link
Contributor

F12 should be fixed now. F12's handler was firing, but the dev tools weren't being opened properly

see #212

@cpriest cpriest closed this as completed Feb 23, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants