LogoLogo
Github
  • Overview
    • 📄Litepaper
  • GraphLinq Chain
    • Networks
      • Specs
        • Geth Client
        • Clique Consensus
      • GraphLinq Chain (Mainnet)
        • Wallet
          • Add GraphLinq Chain to Metamask
          • Add GraphLinq Chain To Ledger
        • RPC Public Nodes
        • Json-RPC API
        • Libraries
        • Execution Clients
        • Explorer
        • Status
    • GLQ
      • Allocation
      • Bridge
      • Rewards
  • 🎶Run a node
    • Installation
  • Dev tooling
    • Introduction
      • Vision
    • Graphs
      • What are Graphs and how do they work?
      • Creating a graph
      • File compression
      • Graph Cycle Costs
      • Node & Fees
    • Engine
      • Setting up the environment
      • Running an Engine locally
    • Dashboard Interface
      • Importing Graph/Template
      • Deploying a Graph
      • Managing Graph State
    • Blocks
      • Base Variable
        • Boolean
        • Decimal
        • Integer
        • KeyValue
        • Long
        • String
        • Get variable
        • Is Variable Exist
        • Set variable
        • Variable Portal
        • Secret String
      • Common
        • Entry Point
        • On Graph Start
        • Stop Graph
      • Time
        • Get Milliseconds Timestamp
        • Get Milliseconds Timestamp Offset
        • Get Timestamp
        • Get Timestamp Offset
        • Timer
        • Format Date
        • Millisecond Timestamp to Date
        • Timestamp to Date
        • Execution Time Interval
      • JSON
        • Last Node to JSON
        • Convert To JSON
        • Add JSON Property
        • Create JSON Object
        • JSON Deserialize To Array
        • JSON to JSON Object
        • Merge JSON
        • Serialize JSON Object
        • Serialize to JSON
      • Log
        • Print
      • WebSocket
        • WebSocket Client Close
        • WebSocket Client Connector
        • On WebSocket Client Disconnect
        • WebSock Receive Data Event
        • WebSocket Send Data
      • String
        • String Contains
        • Concat String
        • Replace String in String
      • Math
        • Subtract A - B
        • Add A + B
        • Ceiling
        • Divide A / B
        • Floor
        • Modulo A % B
        • Multiply A * B
        • Percentage Difference
        • Round
      • HTTP
        • Array To Body Values
        • Array To JSON Body
        • Put HTTP Request
        • Post HTTP Request
        • Get HTTP Request
        • Delete HTTP Request
      • Function
        • Function Block
        • Add Function Parameter
        • Set Function Result
        • Call Function
        • Get Function Result Parameter
        • Get Function Parameter
      • Transformers
        • String to Base64
      • Data
      • CSV
      • Base Condition
        • Decimal Branch
        • Integer Branch
        • String Branch
        • Boolean Branch
      • Range Condition
        • Decimal Range Branch
      • Array
        • Add Array Element
        • Clear Array
        • Create Array
        • Each Element In Array
        • Get Array Element At Index
        • Get Array Size
        • Keep Last X Elements In Array
      • Dictionary
      • Hosted API
    • Blocks (Messaging)
      • Twitter
      • Twitch
      • Telegram
      • SMTP
      • ShortenURL
      • PushOver
      • PushBullet
      • OpenAI
      • Discord
        • Add Emoji On Message
        • Send Discord Channel File
        • Add Role User
        • On Discord Channel Message
        • On Reaction Added Message
        • On Reaction Removed Message
        • Remove Role User
        • Reply Private Discord Message
        • Send Discord Channel Message
        • Discord Connector
        • On Discord Private Message
    • Blocks (Exchange)
      • Binance
      • Bitfinex
      • Bittrex
      • CoinEx
      • CoinGecko
        • Get CoinGecko Coin
      • Huobi
      • Kraken
      • KuCoin
      • LiveCoinWatch
      • MXC
    • Blocks (Blockchains)
      • Avalanche
        • Network Blocks
          • Avalanche Connector
          • Get Block Parameters
          • Get Transaction Parameters
          • On Avalanche Block
          • On Avalanche Transaction
        • Avascan
          • Get Avascan Supply
          • Get Avascan Global Stats
          • Get Avascan Staking Stats
          • Get Avascan Burned Fees
        • SnowTrace
          • SnowTrace Connector
          • Get ERC-20 Balance For Contract
          • Get ERC-20 Token Supply
          • Get Total AVAX on C-Chain
          • Get AVAX Balance Single Address
      • Binance Smart Chain
        • Network Blocks
          • Binance Smart Chain Connector
          • On Binance Smart Chain Block
          • On Binance Smart Chain Transaction
          • On Binance Smart Chain Wallet Transaction
        • BEP20 Blocks
          • Create BEP20 Token
          • Deploy BEP20 Token
      • Elrond
        • Elrond Connector
        • Get Elrond HyperBlock By Hash
        • Get Elrond Transaction
        • Get Elrond Wallet Balance
      • Ethereum
        • Ethereum Connector
        • On Ethereum Block
        • On Ethereum Transaction
        • On Ethereum Wallet Transaction
        • Estimate Gas Price
        • Get Ether Balance
        • Get Block Parameters
        • Get Transaction Parameters
        • Etherscan
          • Etherscan Connector
          • Etherscan Get Gas Price
        • Ethereum Managed Wallet
          • Get Personal Managed Wallet
        • Ethereum ERC20
          • Get ERC20 Holders
          • Get ERC20 Balance
          • Get ERC20 Information
          • Create ERC20 Token
          • Deploy ERC20 Token
        • Ethereum NFT
          • Create NFT Contract
          • Deploy NFT Contact
          • Create New Mintable NFT Token
          • Deploy New Mintable NFT Token
      • Polygon
        • Polygon Connector
      • Quickswap
        • Get Quickswap Pair Price
        • Get Quickswap Token Price
        • Get Quickswap LP Token
        • Get Quickswap LP Token Price
        • On Quickswap Swap
        • On Quickswap Sync
      • Unicrypt
        • Get Unicrypt Locked Token Parameters
        • Get Unicrypt Locked Tokens
        • Get Unicrypt Total Locked Liquidity
        • Get Unicrypt All LP Locked Tokens Address
        • On Unicrypt Deposit
      • Uniswap
        • Get Uniswap LP Token
        • Get Uniswap LP Token Price
        • Uniswap Get Pair Price
        • Get Uniswap Token Price
        • On Uniswap Swap
        • On Uniswap Sync
      • Solana
    • Blocks (Charting)
      • Generate Time Series One Line Chart
      • Generate Time Series Two Line Chart
    • Blocks (Machine Learning)
      • Spam Detection
      • Sentiment Analysis
    • Node Connector Colors
      • Strings & Variables
      • Execution Logic (Yellow)
      • Integers (orange)
      • Booleans (pink)
    • Block Execution Order
      • Additional Block Execution
    • Block Color
      • Colors & Meaning
    • Block Type Overview
      • Function Type
      • Entry Point Type
      • Event Trigger Type
      • Variable Type
      • Condition Type
      • Connector Type
  • Nocode Users
    • Instant Deploy Wizard
    • GraphLinq Marketplace
  • Twitter
  • Medium
  • Github
  • GraphLinq Explorer
  • Audit Report
Powered by GitBook
On this page
  1. Dev tooling
  2. Blocks
  3. Log

Print

PreviousLogNextWebSocket

Last updated 1 year ago

Print Blocks:

The "Print" blocks in the GraphLinq IDE serve the purpose of recording messages into the logs of a graph while it is running. These blocks play a crucial role in aiding experimentation, debugging, and event recording within the graph development process.

Main Use Cases:

  1. Experimentation and Debugging: Using "Print" blocks to output values calculated by the graph is a valuable approach for experimenting with different blocks and testing the graph's functionality. During development, developers can quickly assess the behavior of the graph by logging intermediate results, variable values, and execution status. The real-time feedback provided by the "Print" blocks helps in identifying potential issues and streamlining the debugging process. As a local context is provided, it becomes easier to verify the correctness of the graph's logic.

  2. Recording Graph Events: "Print" blocks also serve as a means to record significant events and activities within the graph. These messages are stored persistently in the logs associated with the specific graph. For instance, "Print" blocks can be utilized to record error messages when certain conditions go wrong, providing insights for error handling and troubleshooting. Moreover, they can be effectively used to monitor the frequency of user commands submitted to GraphLinq-based applications like Discord bots.

Examples:

  1. Simple "Hello World" Message: The simplest use of a "Print" block involves recording a message, such as "Hello World," into the logs at the beginning of the graph's execution. This helps in verifying that the graph has started successfully. The output message appears in the terminal at the bottom right of the IDE and is time-stamped for reference.

  2. Recording Telegram Channel Commands: In a more complex scenario, "Print" blocks can be employed to record events when specific commands are detected in a Telegram channel. Using cascading "String Branch" blocks, messages submitted in the Telegram channel are checked to see if they match specific commands, such as "/menu", "/price", or "/links". Whenever these commands are detected, corresponding "Print" blocks are used to log messages in the graph's logs, indicating the commands' occurrences.

    Note that the "Print" messages are not visible to the users in the Telegram channel; instead, they are stored in the graph's logs. This enables the graph owner to access and analyze the data later, determining the frequency and usage of different commands by members of the Telegram channel.

In conclusion, "Print" blocks are a powerful tool for developers to gain insights into their graph's behavior and operation. By providing real-time feedback and recording important events, these blocks contribute significantly to the efficient development, testing, and monitoring of graphs. The logs containing the "Print" messages offer valuable information for assessing the graph's performance and user interactions.

Here is the simplest possible use of a Print block, in which we are recording the string "Hello World" into the logs one time, upon the beginning of the graph's execution:

This would result in the following time-stamped message appearing in the terminal at the bottom right of the IDE:

You can access the full logs for your graph by clicking on the "View Logs" button for your graph on the "My Graphs" page in the interface:

The following is a more involved example in which Print blocks are being used to record a note in the logs each time certain commands are detected in a Telegram channel:

Presumably, if this was a real graph, then it would contain logic for each of these three commands that would cause our bot to react to the commands appropriately, for example by fetching the price of whatever token we care about and then outputting it into the Telegram channel whenever the "/price" command is detected. The implication here is that all such logic would appear to the right of our image, along those three yellow executive connections.

What we have done here is insert Print blocks into our three yellow branches to output messages into our logs that record which commands have been detected. These messages will not be seen by the users in the Telegram channel; rather, they will be stored in the graph's logs so that the owner of the graph could later access them and determine when and how frequently the different commands are used by members of the Telegram channel.

In the above example, we are using cascading blocks in order to check every message submitted in a Telegram channel to see if it is one of three commands we are listening for "/menu", "/price", or "/links".

String Branch