Gathering detailed insights and metrics for pinia-logger
Gathering detailed insights and metrics for pinia-logger
npm install pinia-logger
Typescript
Module System
Node Version
NPM Version
77.7
Supply Chain
99.5
Quality
76.7
Maintenance
100
Vulnerability
100
License
TypeScript (78.25%)
Vue (14.76%)
JavaScript (3.68%)
HTML (3.3%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
349,889
Last Day
271
Last Week
6,237
Last Month
23,228
Last Year
201,568
9 Stars
41 Commits
4 Forks
1 Watchers
3 Branches
3 Contributors
Updated on Nov 22, 2024
Minified
Minified + Gzipped
Latest Version
1.3.13
Package Id
pinia-logger@1.3.13
Unpacked Size
14.80 kB
Size
4.65 kB
File Count
6
NPM Version
10.2.4
Node Version
20.11.1
Published on
Apr 05, 2024
Cumulative downloads
Total Downloads
Last Day
129.7%
271
Compared to previous day
Last Week
16.4%
6,237
Compared to previous week
Last Month
46.6%
23,228
Compared to previous month
Last Year
72.8%
201,568
Compared to previous year
For Nuxt users, see pinia-logger-nuxt
1yarn add pinia-logger
or
1npm install pinia-logger --save-dev
1import { PiniaLogger } from "pinia-logger";
2
3const pinia = createPinia();
4
5// Defaults are:
6// const defaultOptions = {
7// logErrors: true,
8// disabled: false,
9// expanded: true,
10// showStoreName: true,
11// showDuration: false,
12// showTime: true,
13// filter: () => true
14// actions: undefined
15// logger: console
16// }
17
18pinia.use(
19 PiniaLogger({
20 expanded: true,
21 disabled: process.env.mode === "production",
22 // use a filter to only log certain actions
23 filter: ({ name }) => name !== "incrementCounter",
24 // alternatively, you can specify the actions you want to log
25 // if undefined, all actions will be logged
26 actions: ["decrementCounter"],
27 })
28);
29
30app.use(pinia);
You can also set the logger options in the store. For example:
1export const useCounterStore = defineStore({ 2 id: "counter", 3 state: () => ({ 4 counter: 0, 5 }), 6 actions: { 7 incrementCounter() { 8 this.counter++; 9 }, 10 decrementCounter() { 11 this.counter--; 12 }, 13 }, 14 // you can also set the logger options in the store 15 logger: { 16 expanded: true, 17 disabled: process.env.mode === "production", 18 // use a filter to only log certain actions 19 filter: ({ name }) => name !== "incrementCounter", 20 // alternatively, you can specify the actions you want to log 21 // if undefined, all actions will be logged 22 actions: ["decrementCounter"], 23 }, 24}); 25 26// or using setup style store definition 27export const useCounterStore = defineStore( 28 "counter", 29 () => { 30 const count = ref(0); 31 const increment = () => count.value++; 32 const decrement = () => count.value--; 33 return { 34 count, 35 increment, 36 decrement, 37 }; 38 }, 39 // use the third argument to set the logger options 40 { 41 logger: { 42 // only log the decrement action 43 actions: ["decrementCounter"], 44 }, 45 } 46);
1import { PiniaLoggerOptions } 2 3// Options interface is: 4export interface PiniaLoggerOptions { 5 disabled?: boolean; 6 expanded?: boolean; 7 showDuration?: boolean; 8 showTime?: boolean; 9 showPineapple?: boolean; 10 showStoreName?: boolean; 11 logErrors?: boolean; 12 filter?: (action: PiniaActionListenerContext) => boolean; 13 actions?: KeyOfStoreActions<Store>[] 14 logger?: Logger 15}
1.3.10 - 2023-01-16
{...foo}
showTime
optionactions
optionlogger
property1.3.6 - 2022-09-20
filter
option. Use a filter function to only log certain actionsNo vulnerabilities found.
No security vulnerabilities found.