Jafar

Jafar

  • Docs
  • Form Demos
  • Components Demos
  • Layout Demos
  • Editor
  • GitHub

›Form Class

Getting started

  • Introduction

Form Class

  • Installation
  • Overview
  • Arguments
  • Id
  • Data
  • Fields
  • Path
  • Component
  • Formatter & Parser
  • Dependencies
  • Required
  • Validators
  • Exclude Term
  • Disable Term
  • Require Term
  • Dependencies Change
  • Context
  • Dirty
  • Invalid
  • Errors
  • Processing
  • Pending Actions
  • Hooks
  • Term
  • Log
  • Error Codes
  • Actions
  • Definition Shorthand

Advanced Usages

  • Grid Usage
  • Form Persistency
  • Undo & Redo
  • Replay Actions
  • Track Actions
  • Server Validation
  • Entity Templates
  • Folder Structure

React Form

  • Installation
  • Overview
  • Form
  • Field
  • Components
  • Layout
  • Demos

More Info

  • Test Jafar
  • Packages
  • Why Jafar?
  • Videos
  • Channels

Contribute

  • Code of Conduct
  • Contributing Guide
  • Contributors

Log

Jafar logs error, warning and debug messages according to a log level. The log level is shared across forms, i.e changing it will affect all defined forms.

Log Levels

NameDescription
NoneJafar logs no messages
ErrorJafar logs errors messages
WarningJafar logs errors and warnings messages
DebugJafar logs errors, warnings and debug messages

Debug messages logs all the changes that are applied to the form per each action (such as init, changeFieldValue and more). Each debug message contains the sub action (dispatch action) which changes the internal private form model, and the new form model object. Some dispatch actions affect the ui, and will update the ui to use the new form model object (by passing the UI - such as the react Form component the new form model object to share in its context to its child components like the react Field component)

Note: Debug messages appear on verbose / debug tab of the browser's console - and not under info tab. Also by default they appear only when NODE_ENV === 'development' (e.g - on localhost debug), and therefor do not appear in the online Jafar demos.

Example

Change field value causing the bellow debug messages. Change field value caused 3 ui renders (marked as + UI update):

  1. Setting model.fields.fieldId.component.value - to the new value. That's the placement which keeps the "view value" and should immediately change for a fast ui reaction to the user.
  2. When the form starts to process the new incoming action of change field value. We notify the ui change here since you will probably want to disable a save button while the form is processing (calculating validations and more).
  3. When the form end to process the actions queue. We notify the ui change here since you will probably want to enable the save button after the above disable.

Manage Page

In the above image we can see the following debug messages:

  1. Set model.fields.fieldId.component.value - to the new value (view value)
  2. Add the action to the model.pendingActions queue
  3. Start process the model.pendingActions queue
  4. Start handle the action of - change field value
  5. Set the new field value to the model.data object
  6. Set field evaluation results (errors, disabled and more) - after calculating validations, exclude term and more.
  7. Set form evaluation results (invalid and more)
  8. Remove the action from the queue
  9. End handle the action of - change field value
  10. End process the model.pendingActions queue (queue is empty)

Default Log Level

If process.env.NODE_ENV is 'development' then the default is logLevels.DEBUG, otherwise its logLevels.ERROR

Change Log Level

Change log level using the following exposed setLogLevel function and logLevels enum:

import { setLogLevel, logLevels } from '@jafar/form';

setLogLevel(logLevels.DEBUG);
← TermError Codes →
  • Log Levels
  • Default Log Level
  • Change Log Level
Jafar
Copyright © 2020 Verizon Media
DOCS
IntroductionForm ClassReact FormReact ComponentsReact Layout
DEMOS
React FormReact ComponentsReact Layout
CONTRIBUTING
Code Of ConductContributing GuideUsers
CHANNELS
StarGitHubStack OverflowMediumVideos