FCF 2.0 development in progress...
> > > > > >
[News] [Packages API] [Downloads] [Donate to the project] [Contacts]

constructor() method from fcf.Logger class

constructor(object|fcf.Configuration a_configuration)

Package: fcf-framework-core

File: fcf-framework-core:fcf.js

Available from version: 2.0.2

Class constructor


object|fcf.Configuration a_configuration
- Configuration object.
  • integer|string logLevel = fcf.Logger.LOG - Logging level

    • fcf.Logger.TST|0|"tst"|"test" - Test level of logging.

    • fcf.Logger.CRH|10|"crh"|"crash" - Logging level "application crash".

    • fcf.Logger.ERR|20|"err"|"error" - Error logging level.

    • fcf.Logger.WRN|30|"wrn"|"warning" - Warning logging level.

    • fcf.Logger.INF|40|"inf"|"info" - Information level of logging.

    • fcf.Logger.LOG|50|"log" - The default logging level.

    • fcf.Logger.DBG|60|"dbg"|"debug" - Debug logging level.

    • fcf.Logger.TRC|70|"trc"|"trace" - Trace logging level.

  • string logFile - (Server only) - Log file path prefix. If the parameter is not specified, the output to the file is not performed.


    logFile value: "log/log-"

    real file path: "log/log-2023-01-27.log"

  • number logMaxFileSize = 1 - Maximum log file size in megabytes

  • number logLifeTime = 10 - Log file storage time in days

  • [string|function] logHandlers = [...] - An array with the names of functions or the functions themselves for processing the logged message. To output the log to the console and to the file, another call to the handlers is used to generate a message. By default, the parameter has the following value:

    [ "fcf.Logger.timeHandler", // - Adds the current time "fcf.Logger.spaceServerHandler", // - Adds a space, but only on the server side "fcf.Logger.pidHandler", // - Adds the PID of the process, but only on the server side "fcf.Logger.spaceHandler", // - Adds a space "fcf.Logger.levelHandler", // - Adds a logging level to a message "fcf.Logger.spaceHandler", // - Adds a space "fcf.Logger.modHandler", // - Adds the name of the module for which the logger was called "fcf.Logger.colonHandler", // - Adds a colon "fcf.Logger.messageHandler", // - Appends the message passed as arguments "fcf.Logger.consoleHandler", // - Prints a message to the console "fcf.Logger.fileHandler" // - Outputs a message to a file, but only on the server side ]

    Logger handler functions have the following signature:

    handler(object a_info)

    • object a_info - Information object

      • integer level - Logging level

      • string module - The name of the module from which the logging is called

      • string output - Prefixed output message (populated by handlers)

      • string message - Displaying a message without prefixes (filled in by the fcf.Logger.messageHandler handler)

      • [mixed] args - Arguments passed to logger for output

      • fcf.Logger logger - Pointer to logger object

      • boolean break - If true, then further execution of handlers is interrupted