Skip to content

Conversation

@BlankParticle
Copy link

Server class has bunch of default console.log which are not overriden by Agent's on* methods, so if you are using Agent class that is based on Server your logs gets filled with the default connected/disconnected messages which is annoying
so I just removed the default console logs as they serve no purpose and most people overwrite them anyways

console.info(
`Implement onException on ${this.#ParentClass.name} to handle this error.`
);
// console.error(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we want to keep this one, no? odd to have an exception that you haven't caught or handled here

console.log(
`Implement onAlarm on ${this.#ParentClass.name} to handle alarms.`
);
// console.log(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we want to keep this one, no? would be weird to set an alarm and not have overridden this

console.warn(
`onRequest hasn't been implemented on ${this.#ParentClass.name}:${this.name} responding to ${request.url}`
);
// console.warn(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we want to keep this one, or you'll get a request without a log, and won't know what to do here?

console.info(
`Implement onError on ${this.#ParentClass.name} to handle this error.`
);
// console.error(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as onException, you probably don't want a websocket error that isn't handled

console.info(
`Implement onMessage on ${this.#ParentClass.name} to handle this message.`
);
// console.log(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

receiving messages without handling them?

console.log(
`Connection ${connection.id} connected to ${this.#ParentClass.name}:${this.name}`
);
// console.log(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one I could be convinced, but it is causing a problem?

@BlankParticle
Copy link
Author

I think this has something to do with how Agent class implements the on* callback handlers, I didn't think about this properly but if the agent class is overriding the on* handlers, these console logs should not event be there as they were overriden

but yeah, I went over board, in reality I only want the onConnection console to be gone, which should have been overriden by agent core, but look like agent core calls in the original function

If you want I will edit the PR to only fix the one console log I was annoyed about so that you can merge it

@threepointone
Copy link
Collaborator

hmm ok I think there might be a bug with the on* method binding, I'll have a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants