GithubHelp home page GithubHelp logo

Custom logging about eris-fleet HOT 8 CLOSED

danclay avatar danclay commented on July 24, 2024
Custom logging

from eris-fleet.

Comments (8)

danclay avatar danclay commented on July 24, 2024 1

You should be able to do whatever you want with the errors in your index.js file. It is emitted as log, debug, or error. So you could do

const Admiral = new Fleet(options);

Admiral.on('log', m => {
// Do whatever you want with the log
});
Admiral.on('debug', m => {
// Do whatever you want with the log
});
Admiral.on('error', m => {
// Do whatever you want with the log
});

from eris-fleet.

ThatTonybo avatar ThatTonybo commented on July 24, 2024

Got it. Side question as well ~ how do you set the shard's status? Workers don't seem to receive any ready event.

from eris-fleet.

danclay avatar danclay commented on July 24, 2024

Each cluster is considered ready when all the shards within that cluster are ready. Your code loads after all shards within a cluster are ready.

from eris-fleet.

ThatTonybo avatar ThatTonybo commented on July 24, 2024

So theoretically, slapping the editStatus code anywhere in the bot.js would work?

from eris-fleet.

danclay avatar danclay commented on July 24, 2024

Yes, you shouldn't have to worry about the client not being ready in your bot.js file since it only loads the code when the client is ready.

from eris-fleet.

ThatTonybo avatar ThatTonybo commented on July 24, 2024

Sounds good. One last question that just popped up:
Are stats not first known on start up? Tried using the ipc.getStats() function and it returns this:

{"guilds":0,"users":0,"clustersRam":0,"voice":0,"largeGuilds":0,"shardCount":0,"clusters":[]}

from eris-fleet.

danclay avatar danclay commented on July 24, 2024

Stats are started once all services and clusters have launched. It may be possible to give stats as each cluster comes online, but this will give inaccurate stats so I'm conflicted on making that change. If I give 0 for each value, then your code can know if the stats are not ready since everything is 0. You can listen for stats updates by registering the "stats" event in IPC. Here's an example:

this.ipc.register("stats", (message) => {
   const stats = message.msg;
   // Do stuff with the stats
});

from eris-fleet.

ThatTonybo avatar ThatTonybo commented on July 24, 2024

I'd like it to be an option. Otherwise looks good, I can just wait until the stats are ready.

from eris-fleet.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.