Close Menu
Soshace Digital Blog

    Subscribe to Updates

    Get The Latest News, Updates, And Amazing Offers

    What's Hot
    ASP.NET

    Fluent Validation in ASP.NET MVC

    Job

    Top 6 Things every U.S. Company Should Do Before Hiring a Foreign Independent Contractor

    Machine Learning

    Unsupervised Sentiment Analysis using VADER and Flair

    Important Pages:
    • Home
    • About
    • Services
    • Contact Us
    • Privacy Policy
    • Terms & Conditions
    Facebook X (Twitter) Instagram LinkedIn YouTube
    Today's Picks:
    • Scaling Success: Monitoring Indexation of Programmatic SEO Content
    • Leveraging Influencers: Key Drivers in New Product Launches
    • How Privacy-First Marketing Will Transform the Industry Landscape
    • The Impact of Social Proof on Thought Leadership Marketing
    • Balancing Value-Driven Content and Promotional Messaging Strategies
    • Top Influencer Marketing Platforms to Explore in 2025
    • Emerging Trends in Marketing Automation and AI Tools for 2023
    • Strategies to Mitigate Duplicate Content in Programmatic SEO
    Saturday, October 4
    Facebook X (Twitter) Instagram LinkedIn YouTube
    Soshace Digital Blog
    • Home
    • About
    • Services
    • Contact Us
    • Privacy Policy
    • Terms & Conditions
    Services
    • SaaS & Tech

      Maximizing Efficiency: How SaaS Lowers IT Infrastructure Costs

      August 27, 2025

      Navigating Tomorrow: Innovations Shaping the Future of SaaS

      August 27, 2025

      Maximizing Impact: Strategies for SaaS & Technology Marketing

      August 27, 2025
    • AI & Automation

      Enhancing Customer Feedback Analysis Through AI Innovations

      August 27, 2025

      Navigating the Impact of AI on SEO and Search Rankings

      August 27, 2025

      5 Automation Hacks Every Home Service Business Needs to Know

      May 3, 2025
    • Finance & Fintech

      Critical Missteps in Finance Marketing: What to Avoid

      August 27, 2025

      Analyzing Future Fintech Marketing Trends: Insights Ahead

      August 27, 2025

      Navigating the Complex Landscape of Finance and Fintech Marketing

      August 27, 2025
    • Legal & Compliance

      Exploring Thought Leadership’s Impact on Legal Marketing

      August 27, 2025

      Maximizing LinkedIn: Strategies for Legal and Compliance Marketing

      August 27, 2025

      Why Transparency Matters in Legal Advertising Practices

      August 27, 2025
    • Medical Marketing

      Enhancing Online Reputation Management in Hospitals: A Guide

      August 27, 2025

      Analyzing Emerging Trends in Health and Medical Marketing

      August 27, 2025

      Exploring Innovative Content Ideas for Wellness Blogs and Clinics

      August 27, 2025
    • E-commerce & Retail

      Strategic Seasonal Campaign Concepts for Online and Retail Markets

      August 27, 2025

      Emerging Trends in E-commerce and Retail Marketing Strategies

      August 27, 2025

      Maximizing Revenue: The Advantages of Affiliate Marketing for E-Commerce

      August 27, 2025
    • Influencer & Community

      Leveraging Influencers: Key Drivers in New Product Launches

      August 27, 2025

      Top Influencer Marketing Platforms to Explore in 2025

      August 27, 2025

      Key Strategies for Successful Influencer Partnership Negotiations

      August 27, 2025
    • Content & Leadership

      The Impact of Social Proof on Thought Leadership Marketing

      August 27, 2025

      Balancing Value-Driven Content and Promotional Messaging Strategies

      August 27, 2025

      Analyzing Storytelling’s Impact on Content Marketing Effectiveness

      August 27, 2025
    • SEO & Analytics

      Scaling Success: Monitoring Indexation of Programmatic SEO Content

      August 27, 2025

      Strategies to Mitigate Duplicate Content in Programmatic SEO

      August 27, 2025

      Effective Data Visualization Techniques for SEO Reporting

      August 27, 2025
    • Marketing Trends

      How Privacy-First Marketing Will Transform the Industry Landscape

      August 27, 2025

      Emerging Trends in Marketing Automation and AI Tools for 2023

      August 27, 2025

      Maximizing ROI: Key Trends in Paid Social Advertising

      August 27, 2025
    Soshace Digital Blog
    Blog / Programming / 7. Уроки Node.js. Модуль Console
    Programming

    7. Уроки Node.js. Модуль Console

    bragin_paBy bragin_paSeptember 12, 2016Updated:December 6, 2024No Comments2 Mins Read
    Facebook Twitter Pinterest Telegram LinkedIn Tumblr Email Reddit
    7. Уроки Node.js. Модуль Console
    Share
    Facebook Twitter LinkedIn Pinterest Email Copy Link

    7
    А теперь поговорим о следующем встроенном модуле console. Как мы уже знаем , он использует  util.format и util.inspect для вывода. Console в отличие от util является глобальной переменной. Это большая редкость в Node.js, но, действительно, сonsole не обязательно мы должны require. Она есть везде.

    Теперь кратко взглянем на основные методы этого объекта, отчасти их всего два. Создадим файл console.js и в нем напишем:

    // NO console.debug
    
    console.log("Log"); // = info (out)
    
    console.error("Error"); // = warn (err)

     console.log или это то же самое, что и console.info. И  console.error – то же самое что и console.warn. Для чего существуют два метода? Сейчас запущу node console.js. Есть ли разница? По виду ее нет, но на самом деле она существует. Она заключается в том, что log выводит стандартный поток вывода, а error выводит поток ошибок. Это системные термины.  Смысл такой, что у каждой программы, у каждого процесса  есть  как минимум два потока вывода. Первый считается нормальным выводом, второй считается ошибками. Можно их, например, направить в разные файлы (пишем в терминале):

    node console.js 1>ok 2>err

    То, что выведено в первый поток пойдет в файл ok. Сейчас там находится log. То, что вывелось во второй поток, в поток ошибок, находится в  err.

    Таким образом, если мы делаем перенаправление вывода и правильно используем Error и Log, то мы всегда можем отличить хорошее сообщение от ошибки.

    Кроме этих методов есть еще метод, который используется достаточно редко:

    console.trace(); // (err)

    Он выводить текущий стек trace – тоже в поток ошибок. Бывает иногда полезно, но редко.

    Наконец:

    // NO console.debug

    Обращаю ваше внимание на этот метод, точнее на его отсутствие. В браузерах он обычно есть, а в Node.js его нету.

    Read More:  4. Уроки Node.js. Структура Пакета NPM

    Код урока вы можете найти в нашем репозитории.
    nodejs

    Материал урока взят из следующего скринкаста.

    We are looking forward to meeting you on our website blog.soshace.com

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    bragin_pa

      Related Posts

      3. Уроки Express.js. Шаблонизация с EJS: Layout, Block, Partials

      December 16, 2016

      Уроки Express.js . Логгер, Конфигурация, Шаблонизация с EJS. Часть 2.

      December 2, 2016

      2. Уроки Express.js . Логгер, Конфигурация, Шаблонизация с EJS. Часть 1.

      November 24, 2016

      Comments are closed.

      Stay In Touch
      • Facebook
      • Twitter
      • Pinterest
      • Instagram
      • YouTube
      • Vimeo
      Don't Miss
      LinkedIn December 10, 2024

      Strategic Methods for Building a LinkedIn Prospect List

      To effectively build a LinkedIn prospect list, employ targeted search filters based on industry, location, and job title. Engage with relevant groups and leverage advanced boolean search techniques to identify potential leads aligned with your goals.

      Daily Schedule Post

      June 25, 2016

      5 Essential SEO Tips for Web Developers

      June 25, 2019

      Style like a pro with CSS variables

      May 12, 2023

      Categories

      • AI & Automation
      • Angular
      • ASP.NET
      • AWS
      • B2B Leads
      • Beginners
      • Blogs
      • Business Growth
      • Case Studies
      • Comics
      • Consultation
      • Content & Leadership
      • CSS
      • Development
      • Django
      • E-commerce & Retail
      • Entrepreneurs
      • Entrepreneurship
      • Events
      • Express.js
      • Facebook Ads
      • Finance & Fintech
      • Flask
      • Flutter
      • Franchising
      • Funnel Strategy
      • Git
      • GraphQL
      • Home Services Marketing
      • Influencer & Community
      • Interview
      • Java
      • Java Spring
      • JavaScript
      • Job
      • Laravel
      • Lead Generation
      • Legal & Compliance
      • LinkedIn
      • Machine Learning
      • Marketing Trends
      • Medical Marketing
      • MSP Lead Generation
      • MSP Marketing
      • NestJS
      • Next.js
      • Node.js
      • Node.js Lessons
      • Paid Advertising
      • PHP
      • Podcasts
      • POS Tutorial
      • Programming
      • Programming
      • Python
      • React
      • React Lessons
      • React Native
      • React Native Lessons
      • Recruitment
      • Remote Job
      • SaaS & Tech
      • SEO & Analytics
      • Soshace
      • Startups
      • Swarm Intelligence
      • Tips
      • Trends
      • Vue
      • Wiki
      • WordPress
      Top Posts

      20 JavaScript Interview Questions – Part 2

      Interview March 15, 2019

      How to write effective tests for React apps with react testing library?

      JavaScript October 16, 2020

      Google I/O 2019: New JavaScript Features

      Events May 15, 2019

      Mastering Work-Life Balance: Strategies for Business Owners

      Entrepreneurship November 25, 2024

      Subscribe to Updates

      Get The Latest News, Updates, And Amazing Offers

      About Us
      About Us

      Soshace Digital delivers comprehensive web design and development solutions tailored to your business objectives. Your website will be meticulously designed and developed by our team of seasoned professionals, who combine creative expertise with technical excellence to transform your vision into a high-impact, user-centric digital experience that elevates your brand and drives measurable results.

      7901 4th St N, Suite 28690
      Saint Petersburg, FL 33702-4305
      Phone: 1(877)SOSHACE

      Facebook X (Twitter) Instagram Pinterest YouTube LinkedIn
      Our Picks
      Flask

      Implementing a BackgroundRunner with Flask-Executor

      JavaScript

      Fames Acturpis Egestas Sed Tempus Etpharetra Pharetra

      Node.js

      Node.js Lesson 1: Introduction and Modules

      Most Popular

      5 Website Security Threats and How to Counter Them

      Beginners

      Top IT Conferences and Events in 2020

      Events

      MSP Marketing Made Easy: 7 Proven Automation Tools

      MSP Lead Generation
      © 2025 Soshace Digital.
      • Home
      • About
      • Services
      • Contact Us
      • Privacy Policy
      • Terms & Conditions

      Type above and press Enter to search. Press Esc to cancel.