Skip to content

adding some console.log to Nodebb

Solved Customisation
  • I’m trying some code small addition to NodeBB.
    for debugging purposed where do any outputs from console.log() go?

    Usually, when I run my own stand-alone node code it ‘hangs the screen’ until Ctrl-X out of it, hence you can see console.logs
    But as nodeBB runs as a service in the background, you dont see console.log output on the screen

  • @eeeee output from console.log will be in the console tab of the browser when your press F12 to access the developer tools.

  • phenomlabundefined phenomlab has marked this topic as solved on
  • @phenomlab
    oh, surely only javascript console.log goes to front end, Im meaning using console.log in server side node code.
    What I want is a note to myself on server, not viewable front end.
    for example Ive added some code which doesnt work, and I want to log (somewhere)
    “Reached this code”
    x=10
    etc
    So I want to console log to a server side file I can go and read to help me debug.
    Is there a nodebb log already in use I can write to?
    I tried making my own txt file as using fs.writeFile and that did not work, but thinking some built in console.log command would be simpler

  • @eeeee if you’re using the console, you could try

    node app.js > app.log 2>&1

    This would redirect stdout to a file named app.log and redirect stderr to stdout.

    I’m not sure about standard logging under NodeBB, but there is an error log located at logs/error.log.

    Failing that, you could always stop the NodeBB service then use ./nodebb dev from the console which would then provide debug output.


Did this solution help you?
Did you find the suggested solution useful? Why not buy me a coffee? It's a nice gesture, and a great way to show your appreciation 💗

  • Page control arrows for PWA

    Solved Customisation
    27
    25 Votes
    27 Posts
    339 Views

    @crazycells it is, yes - I think I’ll leave it as there is no specific PWA CSS classes I know of. Well, you could use something like the below, but this means multiple CSS files for different operating systems.

    /** * Determine the mobile operating system. * This function returns one of 'iOS', 'Android', 'Windows Phone', or 'unknown'. * * @returns {String} */ function getMobileOperatingSystem() { var userAgent = navigator.userAgent || navigator.vendor || window.opera; // Windows Phone must come first because its UA also contains "Android" if (/windows phone/i.test(userAgent)) { return "Windows Phone"; } if (/android/i.test(userAgent)) { return "Android"; } if (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) { return "iOS"; } return "unknown"; // return “Android” - one should either handle the unknown or fallback to a specific platform, let’s say Android }

    Once you’re in that rabbit hole, it’s impossible to get out of it.

  • Email validation NodeBB

    Bugs
    21
    3 Votes
    21 Posts
    877 Views

    @Panda said in Email validation NodeBB:

    Did you configure that as a custom change to the usual quote icon. How do you do that?
    I notice on NodeBB site its a solid blue quotes

    Yes, I changed it. NodeBB by default users the free font awesome library whereas I use the pro (paid) version SDK have access to a wider set of icons, and at different thicknesses etc. The change of colour is just simple CSS.

  • 6 Votes
    15 Posts
    703 Views

    No no, I said that in the sense that he told me it was simple ^^
    I was able to see that this was not the case by targeting the elements he had advised me.

  • 0 Votes
    4 Posts
    526 Views

    @cagatay You’d target the body tag and use the below line of CSS

    background: url(/assets/customcss/backgrounds/default/default.png) no-repeat center center fixed;

    Obviously, you need to change the path to suit where your image is being stored.

    More info around the background property can be found here

    https://www.w3schools.com/cssref/css3_pr_background.php

  • NodeBB inline videoplayer

    Solved Customisation
    12
    3 Votes
    12 Posts
    714 Views

    @phenomlab
    YAY! It works
    Thanks so much

  • 5 Votes
    1 Posts
    249 Views
    No one has replied
  • [NodeBB] username cards

    Solved Customisation
    8
    5 Votes
    8 Posts
    829 Views

    @phenomlab

    Aha…nice to know. As always thank you for the reply and information.

  • Display tweets in widget [NodeBB]

    Solved Customisation
    29
    4 Votes
    29 Posts
    2k Views

    @phenomlab brilliant, many thanks Mark 😁