# Logger

TIP

GROWI uses Bunyan (opens new window) and browser-bunyan (opens new window). Older code uses debug (opens new window) for logging, but debug() can be replaced with Bunyan's logger.debug().

# Log Levels

See Bunyan#Levels (opens new window) for more about log levels.

By default, log levels are set as below.

  • Development
    • info
  • Production
    • info

# Log Method

See Bunyan#Log Method API (opens new window).

# Edit Log Setting

There are 2 ways to edit the log setting.

# Edit Log Setting for Indivisual Environments

  • Development
    • config/logger/config.dev.js
  • Production
    • config/logger/config.prod.js

# Format

  • Format as ${namespace}: '${level}',.
    e.g.



     
     


    module.exports = {
      default: 'info',
    
      'growi:crowi': 'debug',
      'growi:routes:login-passport': 'debug',
    }
    
  • The default log level can be set with default key.

# Edit Log Setting with Environmental Variables

WARNING

Environment variables override the setting files.

# Format

  • ${LEVEL}=${namespace1},${namespace2}, ...

e.g.

DEBUG=growi:crowi,growi:routes:login-passport
WARN=growi:crowi:express-init