LogRocket/redux-logger hiện có 5.7k sao trên GitHub, viết chủ yếu bằng JavaScript. Logger for Redux
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
LogRocket is a production Redux logging tool that lets you replay problems as if they happened in your own browser. Instead of guessing why errors happen, or asking users for screenshots and log dumps, LogRocket lets you replay Redux actions + state, network requests, console logs, and see a video of what the user saw.
For more informatiom about the future of redux-logger, check out the discussion here.
Table of contents
Install
Usage
Options
Recipes
Log only in development
Log everything except actions with certain type
Collapse actions with certain type
Transform Immutable (without combineReducers)
Transform Immutable (with combineReducers)
Log batched actions
To Do
Known issues (with react-native only at this moment)
License
Install
npm i --save redux-logger
Typescript types are also available, via DefinitelyTyped:
npm i @types/redux-logger
Usage
import { applyMiddleware, createStore } from 'redux';
// Logger with default options
import logger from 'redux-logger'
const store = createStore(
reducer,
applyMiddleware(logger)
)
// Note passing middleware as the third argument requires redux@>=3.1.0
Or you can create your own logger with custom options:
import { applyMiddleware, createStore } from 'redux';
import { createLogger } from 'redux-logger'
const logger = createLogger({
// ...options
});
const store = createStore(
reducer,
applyMiddleware(logger)
);
Note: logger must be the last middleware in chain, otherwise it will log thunk and promise, not actual actions (#20).
Options
{
predicate, // if specified this function will be called before each action is processed with this middleware.
collapsed, // takes a Boolean or optionally a Function that receives `getState` function for accessing current store state and `action` object as parameters. Returns `true` if the log group should be collapsed, `false` otherwise.
duration = false: Boolean, // print the duration of each action?
timestamp = true: Boolean, // print the timestamp with each action?
level = 'log': 'log' | 'console' | 'warn' | 'error' | 'info', // console's level
colors: ColorsObject, // colors for title, prev state, action and next state: https://github.com/LogRocket/redux-logger/blob/master/src/defaults.js#L12-L18
titleFormatter, // Format the title used when logging actions.
stateTransformer, // Transform state before print. Eg. convert Immutable object to plain JSON.
actionTransformer, // Transform action before print. Eg. convert Immutable object to plain JSON.
errorTransformer, // Transform error before print. Eg. convert Immutable object to plain JSON.
logger = console: LoggerObject, // implementation of the `console` API.
logErrors = true: Boolean, // should the logger catch, log, and re-throw errors?
diff = false: Boolean, // (alpha) show diff between states?
diffPredicate // (alpha) filter function for showing states diff, similar to `predicate`
}
Options description
level (String | Function | Object)
Level of console. warn, error, info or else.
It can be a function (action: Object) => level: String.
It can be an object with level string for: prevState, action, nextState, error
It can be an object with getter functions: prevState, action, nextState, error. Useful if you want to print
message based on specific state or action. Set any of them to false if you want to hide it.
Object with color getter functions: title, prevState, action, nextState, error. Useful if you want to paint
message based on specific state or action. Set any of them to false if you want to show plain message without colors.
Implementation of the console API. Useful if you are using a custom, wrapped version of console.
Default: console
logErrors (Boolean)
Should the logger catch, log, and re-throw errors? This makes it clear which action triggered the error but makes "break
on error" in dev tools harder to use, as it breaks on re-throw rather than the original throw location.
Takes a boolean or optionally a function that receives getState function for accessing current store state and action object as parameters. Returns true if the log group should be collapsed, false otherwise.
If specified this function will be called before each action is processed with this middleware.
Receives getState function for accessing current store state and action object as parameters. Returns true if action should be logged, false otherwise.
Default: null (always log)
stateTransformer = (state: Object) => state
Transform state before print. Eg. convert Immutable object to plain JSON.
Default: identity function
actionTransformer = (action: Object) => action
Transform action before print. Eg. convert Immutable object to plain JSON.
Default: identity function
errorTransformer = (error: Any) => error
Transform error before print.
Default: identity function
titleFormatter = (action: Object, time: String?, took: Number?) => title
Format the title used for each action.
Default: prints something like action @ ${time} ${action.type} (in ${took.toFixed(2)} ms)
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/LogRocket/redux-logger là nguồn chính thức.
LogRocket/redux-logger có bao nhiêu sao?
LogRocket/redux-logger có 5.7k sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/LogRocket/redux-logger. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
LogRocket/redux-logger có phải mã nguồn mở không?
Có — LogRocket/redux-logger phát hành theo license MIT, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/LogRocket/redux-logger.
LogRocket/redux-logger còn đang phát triển không?
Commit gần nhất trên LogRocket/redux-logger là 6.0 năm trước (theo timestamp GitHub). Repo có 317 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
LogRocket/redux-logger là gì?
LogRocket/redux-logger (LogRocket/redux-logger) là dự án JavaScript trên GitHub. Theo mô tả gốc: Logger for Redux
LogRocket/redux-logger so với các dự án Frontend khác thế nào?
LogRocket/redux-logger được TopGit xếp vào nhóm Frontend, với 5.7k sao GitHub và viết bằng JavaScript. Xem trang chủ đề Frontend trên TopGit để so sánh với các dự án tương tự theo số sao và mức độ hoạt động.
Đọc đầy đủ README ở tab phía trên.
Vẫn đang phân vân về redux-logger?
Một cú bấm sẽ gửi câu hỏi kèm trang này cho AI — xem AI nói gì về redux-logger.