All Projects → grady-lad → composition-logger

grady-lad / composition-logger

Licence: MIT License
The most optimal way to visualize/debug functional compositions 🔍

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to composition-logger

rocket-pipes
Powerful pipes for TypeScript, that chain Promise and ADT for you 🚌 -> ⛰️ -> 🚠 -> 🏂 -> 🚀
Stars: ✭ 18 (+20%)
Mutual labels:  pipe, compose
state inspector
State change & method call logger. A debugging tool for instance variables and method calls.
Stars: ✭ 24 (+60%)
Mutual labels:  log
ntee
Portable Unix shell command 'tee', with some extras - read from standard input and write to standard output and files
Stars: ✭ 22 (+46.67%)
Mutual labels:  pipe
ip-logger
📇 When someone clicks the link, you will receive their IP and other information via telegram.
Stars: ✭ 0 (-100%)
Mutual labels:  log
msLog
log for webView & webApp 用于webView和webApp的log工具
Stars: ✭ 25 (+66.67%)
Mutual labels:  log
Panorama360
Projekt przejściowy do projektu Magisterskiego. Android, LibGDX, OpenCV, Camera, SurfaceView, stitching, panorama, sphere, gyroscope
Stars: ✭ 52 (+246.67%)
Mutual labels:  compose
archi cloudnative
Cloud Native Architectural Models using Archi. Contains models for CAAS, Cloud Native Applications, 12/15 Factor Applications with CI/CD/CS, monitoring and log management. Infrastructure components include Red Hat OpenShift, Red Hat Storage, Red Hat Ansible Tower, Red Hat Cloudforms, Red Hat Satellite, Red Hat JBoss Middleware.
Stars: ✭ 55 (+266.67%)
Mutual labels:  log
Compose
Nice and simple DSL for Espresso Compose UI testing in Kotlin
Stars: ✭ 56 (+273.33%)
Mutual labels:  compose
dtail
DTail is a distributed DevOps tool for tailing, grepping, catting logs and other text files on many remote machines at once.
Stars: ✭ 112 (+646.67%)
Mutual labels:  log
yii2-logreader
Yii2 Log Reader
Stars: ✭ 31 (+106.67%)
Mutual labels:  log
UE4 MagicConsole
Enhanced UE4 output log widget
Stars: ✭ 71 (+373.33%)
Mutual labels:  log
polog
Логирование должно быть красивым
Stars: ✭ 26 (+73.33%)
Mutual labels:  log
PlayWeather
🔥🔥🔥 Compose、Lce、MVVM、深色模式、横屏、无网弱网适配、Room、Hilt、多语言切换,目前Android最新的库基本全用上了,你想要的都有🔥🔥🔥
Stars: ✭ 120 (+700%)
Mutual labels:  compose
dlog
A super simple logger for Go. Supports stderr, logfiles, syslog and windows event log.
Stars: ✭ 16 (+6.67%)
Mutual labels:  log
samples
Jetpack Compose based project, used to stress-testing compose features / integrations and explore non-trivial functionality
Stars: ✭ 21 (+40%)
Mutual labels:  compose
k8s-log
容器日志搜集套件。
Stars: ✭ 15 (+0%)
Mutual labels:  log
WatsonSyslogServer
C# Syslog Server
Stars: ✭ 18 (+20%)
Mutual labels:  log
printer
A fancy logger yet lightweight, and configurable. 🖨
Stars: ✭ 65 (+333.33%)
Mutual labels:  log
analog-ce
Analog CE
Stars: ✭ 14 (-6.67%)
Mutual labels:  log
compose-ref
Compose specification reference implementation
Stars: ✭ 69 (+360%)
Mutual labels:  compose

Composition Logger

composition-logger

Installation

To install ( recommended to save as a dev dependency )

npm install composition-logger --save -dev

What is this?

From all the resources that I have seen, the recommended way to debug functional compositions in JavaScript is to provide a function that produces a side effect such as logging to the console and continue to pass the data through the composition, such as ramdas tap function.

This is all well and good but it poses a few limitations such as:

  • Not beginner friendly. Beginners need to understand how functional composition works in order to debug or gain insight in how the data flows through a composition.

  • Debugging methods such as tap can be tedious to work with. Let's say your composition contains a bug, in order to view the data between each step of the compositon, you would be required to manually add the tap function between each step of the composition.

So how can we do better? By utilising console.group and this is exactly what composition-logger does.

composition-logger logs each step of your composition in an organised manner without interuptting the data flow of your composition, making it effortless to debug and giving you continuous insight into your functional compositions.

Usage

composition-logger exposes two functions:

  • pipeWithLogs: Compose from left to right see pipe

  • composeWithLogs: Compose from right to left see compose

Pipe

import { pipeWithLogs } from "composition-logger";

const divideByTwo = data => data / 2;

const sum = data => data.reduce((a, b) => a + b);

const addOne = data => data.map(item => item + 1);

const performCalculation = pipeWithLogs(addOne, sum, divideByTwo);

performCalculation([1, 4, 5, 6, 7]);

The above example will log the following to the browser:

Compose

import { composeWithLogs } from "composition-logger";

const divideByTwo = data => data / 2;

const sum = data => data.reduce((a, b) => a + b);

const addOne = data => data.map(item => item + 1);

const performCalculation = composeWithLogs(divideByTwo, sum, addOne);

performCalculation([1, 4, 5, 6, 7]);

The above example will log the following to the browser:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].