• Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
v3.5.2 Latest
Buy Hosting

How to see what hooks are firing?

Scheduled Pinned Locked Moved General Discussion
9 Posts 3 Posters 1.5k Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • RogerLevyR Offline
    RogerLevyR Offline
    RogerLevy
    wrote on last edited by RogerLevy
    #1

    I'm developing my first plugin and would like to see what hooks are firing. Can nodebb be configured to log all hooks?

    1 Reply Last reply
    0
  • DravereD Offline
    DravereD Offline
    Dravere
    wrote on last edited by
    #2

    Why do you want to see that? What for? If you just want a list of available hooks look at this page: https://github.com/NodeBB/NodeBB/wiki/Hooks

    1 Reply Last reply
    0
  • RogerLevyR Offline
    RogerLevyR Offline
    RogerLevy
    wrote on last edited by
    #3

    To get a shorter path to understanding when certain hooks fire.

    1 Reply Last reply
    0
  • barisB Offline
    barisB Offline
    <baris> NodeBB
    wrote on last edited by baris
    #4

    Not a bad idea, https://github.com/NodeBB/NodeBB/commit/81341e86ee5e6ea839c3460199950128020ad018, run in dev mode or with grunt --verbose

    1 Reply Last reply
    1
  • DravereD Offline
    DravereD Offline
    Dravere
    wrote on last edited by
    #5

    That might be a bit much even for verbose? One click gave me 87 lines of output that I can't post here because even Askimet thinks this is a bit spamy 😄

    It sure might be an interesting idea. But it also doesn't give a lot of information. For example it gives you no context information of the fired hooks. Why was it fired, for what was it fired, etc?

    1 Reply Last reply
    0
  • RogerLevyR Offline
    RogerLevyR Offline
    RogerLevy
    wrote on last edited by
    #6

    Maybe this could be configured to limit hook logs to a match a string. So you could tell it to log only "action" or "post" and that would control the spam 😉

    1 Reply Last reply
    0
  • DravereD Offline
    DravereD Offline
    Dravere
    wrote on last edited by
    #7

    If you're on Linux this can be achieved. I'm at the moment doing this to exclude all of them:
    ./nodebb dev | grep -v "plugins/fireHook"

    If you only want action hooks you could do something like this:
    ./nodebb dev | grep -v -e "plugins/fireHook] filter" -e "plugins/fireHook] static"

    Probably somehow also possible with the PowerShell on Windows.

    RogerLevyR 1 Reply Last reply
    0
  • RogerLevyR Offline
    RogerLevyR Offline
    RogerLevy
    replied to Dravere on last edited by
    #8

    @dravere How would you achieve filtering out every "plugins/fireHook]" line that does NOT also have a certain string? (inclusion as opposed to exclusion)

    1 Reply Last reply
    0
  • DravereD Offline
    DravereD Offline
    Dravere
    wrote on last edited by
    #9

    If you want to filter for hooks you can just leave out the -v. It will exclude every line others than the ones that include the pattern. For example:
    ./nodebb dev | grep "plugins/fireHook] filter:parse.post"

    This would only show you lines that include this pattern. Again you can combine multiple patterns, just provide each via the -e argument. For example:
    ./nodebb dev | grep -e "plugins/fireHook] filter:parse.post" -e "plugins/fireHook] filter:users.get"

    1 Reply Last reply
    1

Copyright © 2023 NodeBB | Contributors
  • Login

  • Don't have an account? Register

  • Login or register to search.
Powered by NodeBB Contributors
  • First post
    Last post
0
  • Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development