Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PocketMine Log Format?

Comments in 'Plugin Development' started by DaveCozens, Apr 12, 2015.

  1. DaveCozens
    Offline

    DaveCozens New Member

    Joined:
    Feb 4, 2015
    Posts:
    20
    So, I'm writing a runs-in-a-browser php based PocketMine console that does the following:

    Requires a login
    Lets me view the crash/restart history (using my own sever monitoring scripts that check for crashlogs etc. working fine.)
    Lets me view the daemon.log (well, the last 100 lines or so)
    Lets me send RCON commands (works a treat)
    Lets me execute shell scripts (dangerous, but working)

    I really want to split the daemon log into it's various components - user chatter, joins, leaves, warnings and server stats (RAM, U, TPS, etc) - but I'm struggling with the logfile format

    I can see pipe (|) is being used as one delimiter but there's also a bunch of non printing characters and such that seem to be involved which implies there's structures inside structures in this data. Simply using pipe and semicolon is getting me OK results but it's not perfect...

    Can somebody point me at some documentation for the log format?

    i.e.

    ]0;PocketMine-MP 1.4.1dev-954 | Online 10/250 | RAM 113.08/160.5 MB | U 3.95 D 3.85 kB/s | TPS 20 | Load 10.07%]0;PocketMine-MP 1.4.1dev-954 | Online 10/250 | RAM 113.22/160.5 MB | U 4.07 D 4.17 kB/s | TPS 20 | Load 9.43%]0;PocketMine-MP 1.4.1dev-954 | Online 10/250 | RAM 113.35/160.5 MB | U 3.38 D 4.26 kB/s | TPS 20 | Load 8.87%]0;PocketMine-MP 1.4.1dev-954 | Online 10/250 | RAM 112.61/160.5 MB | U 3.06 D 3.77 kB/s | TPS 20 | Load 8.62%]0;PocketMine-MP 1.4.1dev-954 | Online 10/250 | RAM 112.76/160.5 MB | U 5.27 D 4.78 kB/s | TPS 20 | Load 10.34%]0;PocketMine-MP 1.4.1dev-954 | Online 10/250 | RAM 112.88/160.5 MB | U 7.13 D 5.15 kB/s | TPS 20 | Load 9.63%]0;PocketMine-MP 1.4.1dev-954 | Online 10/250 | RAM 113.02/160.5 MB | U 8.56 D 5 kB/s | TPS 20 | Load 9.62%]0;PocketMine-MP 1.4.1dev-954 | Online 10/250 | RAM 113.17/160.5 MB | U 7.44 D 5.19 kB/s | TPS 20 | Load 10.01%]0;PocketMine-MP 1.4.1dev-954 | Online 10/250 | RAM 112.98/160.5 MB | U 6.63 D 4.92 kB/s | TPS 20 | Load 8.66%]0;PocketMine-MP 1.4.1dev-954 | Online 10/250 | RAM 112.25/160.5 MB | U 8.67 D 4.89 kB/s | TPS 20 | Load 11.5%]0;PocketMine-MP 1.4.1dev-954 | Online 10/250 | RAM 112.38/160.5 MB | U 6.49 D 4.97 kB/s | TPS 20 | Load 7.53%]0;PocketMine-MP 1.4.1dev-954 | Online 10/250 | RAM 112.71/160.5 MB | U 5.84 D 4.48 kB/s | TPS 20 | Load 9.95%]0;PocketMine-MP 1.4.1dev-954 | Online 10/250 | RAM 112.86/160.5 MB | U 34.65 D 4.3 kB/s | TPS 20 | Load 8.97%]0;PocketMine-MP 1.4.1dev-954 | Online 10/250 | RAM 112.19/160.5 MB | U 5.5 D 4.24 kB/s | TPS 13.54 | Load 77.92%]0;PocketMine-MP 1.4.1dev-954 | Online 10/250 | RAM 112.32/160.5 MB | U 9.89 D 3.9 kB/s | TPS 20 | Load 34.43%]0;PocketMine-MP 1.4.1dev-954 | Online 10/250 | RAM 112.46/160.5 MB | U 6.45 D 3.92 kB/s | TPS 20 | Load 8.96%]0;PocketMine-MP 1.4.1dev-954 | Online 10/250 | RAM 111.72/160.5 MB | U 6.54 D 4.08 kB/s | TPS 20 | Load 9.16%]0;PocketMine-MP 1.4.1dev-954 | Online 10/250 | RAM 111.87/160.5 MB | U 4.53 D 3.28 kB/s | TPS 20 | Load 9.9%[36;1m14:36:05[0m [37;1m[INFO] <DogMan019> NO BAD BOY[0m​
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    | is not a delimiter. If you run normal PocketMine, you would find that the | is part of the window title. The non-printable characters are ANSI tokens that symbolize text color or that the text is part of title.
    You should add --disable-ansi argument when starting PocketMine to take away that thing.
    Normal PocketMine uses PHP_EOL (system line separator) to separate log lines.

    Also, (it doesn't seem suitable for your case) if your PHP script runs in the same process as PocketMine (or maybe you may want to make a plugin that connects with your webserver), you can call $server->getLogger()->addAttachnent() to make a custom additional logger.
  3. DaveCozens
    Offline

    DaveCozens New Member

    Joined:
    Feb 4, 2015
    Posts:
    20
    Awesome. Thanks for that.

    --disable-ansi​

    and I have a nice parseable log...
  4. DaveCozens
    Offline

    DaveCozens New Member

    Joined:
    Feb 4, 2015
    Posts:
    20
    But now this leaves me wondering - what other startup flags are there? Is there a list somewhere?
    D
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder

Share This Page

Advertisement