@nocobase/plugin-logger 0.20.0-alpha.5 → 0.20.0-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- (function(e,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("@nocobase/client"),require("react-i18next"),require("react/jsx-runtime"),require("react"),require("antd"),require("@ant-design/icons"),require("ahooks")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","react-i18next","react/jsx-runtime","react","antd","@ant-design/icons","ahooks"],t):(e=typeof globalThis!="undefined"?globalThis:e||self,t(e["@nocobase/plugin-logger"]={},e["@nocobase/client"],e["react-i18next"],e.jsxRuntime,e.react,e.antd,e["@ant-design/icons"],e.ahooks))})(this,function(e,t,s,r,a,d,m,f){"use strict";var Y=Object.defineProperty,Z=Object.defineProperties;var R=Object.getOwnPropertyDescriptors;var F=Object.getOwnPropertySymbols;var ee=Object.prototype.hasOwnProperty,te=Object.prototype.propertyIsEnumerable;var $=(e,t,s)=>t in e?Y(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,A=(e,t)=>{for(var s in t||(t={}))ee.call(t,s)&&$(e,s,t[s]);if(F)for(var s of F(t))te.call(t,s)&&$(e,s,t[s]);return e},C=(e,t)=>Z(e,R(t));var w=(e,t,s)=>new Promise((r,a)=>{var d=h=>{try{f(s.next(h))}catch(y){a(y)}},m=h=>{try{f(s.throw(h))}catch(y){a(y)}},f=h=>h.done?r(h.value):Promise.resolve(h.value).then(d,m);f((s=s.apply(e,t)).next())});const h="logger";function y(g){return t.i18n.t(g,{ns:h})}function L(){return s.useTranslation(h)}const{Paragraph:E,Text:b}=d.Typography,V=a.memo(()=>{const{t:g}=L();return r.jsxs(d.Typography,{children:[r.jsxs(E,{children:[r.jsx(b,{code:!0,children:"[app]/request_*.log"})," - ",g("API request and response logs")]}),r.jsxs(E,{children:[r.jsx(b,{code:!0,children:"[app]/system_*.log"})," -"," ",g("Application, database, plugins and other system logs, the error level logs will be sent to")," ",r.jsx(b,{code:!0,children:"[app]/system_error_*.log"})]}),r.jsxs(E,{children:[r.jsx(b,{code:!0,children:"[app]/sql_*.log"})," -"," ",g("SQL execution logs, printed by Sequelize when the db logging is enabled")]})]})}),H=a.memo(g=>{const{token:P}=d.theme.useToken(),{t:N}=L(),S=f.useMemoizedFn(N),_=t.useAPIClient(),[U,j]=a.useState(["0"]),[x,G]=a.useState(""),[Q,v]=a.useState(!0),[I,O]=a.useState([]),{data:z}=t.useRequest(()=>_.resource("logger").list().then(o=>{var u;return(u=o.data)==null?void 0:u.data})),q=a.useCallback((o,u)=>o.map((i,c)=>{const n=`${u}-${c}`;return typeof i=="string"?{title:i,key:n,icon:r.jsx(m.FileOutlined,{})}:{title:i.name,key:n,icon:r.jsx(m.FolderOutlined,{}),children:q(i.files,n)}}),[]),k=a.useMemo(()=>{const o=z||[];return[{title:S("All"),key:"0",children:q(o,"0")}]},[z,q,S]),J=o=>{j(o),v(!1)},W=o=>{const{value:u}=o.target,i=n=>n.reduce((l,p)=>{var T;return(T=p.title)!=null&&T.includes(u)&&l.push(p),p.children?[...l,...i(p.children)]:l},[]),c=i(k).map(n=>n.key);j(c),G(u),v(!0),O([])},D=a.useMemo(()=>{if(!x)return k;const o=u=>{const i=[];for(const c of u){const n=c.title,l=n.indexOf(x),p=n.substring(0,l),T=n.substring(l+x.length),K=l>-1?r.jsxs("span",{children:[p,r.jsx("span",{style:{color:P.colorPrimary},children:x}),T]}):r.jsx("span",{children:n});if(l>-1)i.push(C(A({},c),{title:K}));else if(c.children){const B=o(c.children);B.length&&i.push(C(A({},c),{title:K,children:B}))}}return i};return o(k)},[x,k,P.colorPrimary]),X=()=>{const o=(i,c)=>i.reduce((n,l)=>{let p=l.title;return p=l.key==="0"?p:`${c}/${p}`,l.children?[...n,...o(l.children,l.key==="0"?"":p)]:(I.includes(l.key)&&l.key!=="0"&&n.push(p),n)},[]),u=o(k,"");u.length&&_.request({url:"logger:download",method:"post",responseType:"blob",data:{files:u}}).then(i=>{const c=window.URL.createObjectURL(new Blob([i.data],{type:"application/gzip"})),n=document.createElement("a");n.setAttribute("href",c),n.setAttribute("download","logs.tar.gz"),n.click(),n.remove()}).catch(i=>{console.log(i)})};return r.jsxs(d.Card,{style:{minHeight:"700px"},children:[r.jsx(d.Alert,{message:"",description:r.jsx(V,{}),type:"info",showIcon:!0}),r.jsx(d.Input.Search,{style:{marginTop:16,width:"450px"},placeholder:S("Search"),onChange:W}),r.jsx("div",{style:{maxHeight:"400px",width:"450px",overflow:"auto",border:"1px solid",marginTop:"6px",marginBottom:"10px",borderColor:P.colorBorder},children:D.length?r.jsx(d.Tree,{checkable:!0,showIcon:!0,showLine:!0,checkedKeys:I,expandedKeys:U,autoExpandParent:Q,onExpand:J,onCheck:o=>O(o),treeData:D}):r.jsx(d.Empty,{image:d.Empty.PRESENTED_IMAGE_SIMPLE})}),r.jsxs(d.Button,{type:"primary",onClick:X,children:[S("Download")," (.tar.gz)"]})]})});class M extends t.Plugin{afterAdd(){return w(this,null,function*(){})}beforeLoad(){return w(this,null,function*(){})}load(){return w(this,null,function*(){this.app.pluginSettingsManager.add("logger",{title:y("Logger"),icon:"FileTextOutlined",Component:H})})}}e.PluginLoggerClient=M,e.default=M,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(e,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("@nocobase/client"),require("react-i18next"),require("react/jsx-runtime"),require("react"),require("antd"),require("@ant-design/icons"),require("ahooks")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","react-i18next","react/jsx-runtime","react","antd","@ant-design/icons","ahooks"],t):(e=typeof globalThis!="undefined"?globalThis:e||self,t(e["@nocobase/plugin-logger"]={},e["@nocobase/client"],e["react-i18next"],e.jsxRuntime,e.react,e.antd,e["@ant-design/icons"],e.ahooks))})(this,function(e,t,s,r,a,d,k,y){"use strict";var Y=Object.defineProperty,Z=Object.defineProperties;var R=Object.getOwnPropertyDescriptors;var $=Object.getOwnPropertySymbols;var ee=Object.prototype.hasOwnProperty,te=Object.prototype.propertyIsEnumerable;var V=(e,t,s)=>t in e?Y(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,A=(e,t)=>{for(var s in t||(t={}))ee.call(t,s)&&V(e,s,t[s]);if($)for(var s of $(t))te.call(t,s)&&V(e,s,t[s]);return e},C=(e,t)=>Z(e,R(t));var S=(e,t,s)=>new Promise((r,a)=>{var d=h=>{try{y(s.next(h))}catch(f){a(f)}},k=h=>{try{y(s.throw(h))}catch(f){a(f)}},y=h=>h.done?r(h.value):Promise.resolve(h.value).then(d,k);y((s=s.apply(e,t)).next())});const h="logger";function f(g){return t.i18n.t(g,{ns:h})}function L(){return s.useTranslation(h)}const{Paragraph:E,Text:b}=d.Typography,M=a.memo(()=>{const{t:g}=L();return r.jsxs(d.Typography,{children:[r.jsxs(E,{children:[r.jsx(b,{code:!0,children:"[app]/request_*.log"})," - ",g("API request and response logs")]}),r.jsxs(E,{children:[r.jsx(b,{code:!0,children:"[app]/system_*.log"})," -"," ",g("Application, database, plugins and other system logs, the error level logs will be sent to")," ",r.jsx(b,{code:!0,children:"[app]/system_error_*.log"})]}),r.jsxs(E,{children:[r.jsx(b,{code:!0,children:"[app]/sql_*.log"})," -"," ",g("SQL execution logs, printed by Sequelize when the db logging is enabled")]})]})});M.displayName="Tips";const _=a.memo(g=>{const{token:P}=d.theme.useToken(),{t:H}=L(),T=y.useMemoizedFn(H),v=t.useAPIClient(),[U,I]=a.useState(["0"]),[x,G]=a.useState(""),[Q,D]=a.useState(!0),[O,z]=a.useState([]),{data:K}=t.useRequest(()=>v.resource("logger").list().then(o=>{var u;return(u=o.data)==null?void 0:u.data})),q=a.useCallback((o,u)=>o.map((i,c)=>{const n=`${u}-${c}`;return typeof i=="string"?{title:i,key:n,icon:r.jsx(k.FileOutlined,{})}:{title:i.name,key:n,icon:r.jsx(k.FolderOutlined,{}),children:q(i.files,n)}}),[]),m=a.useMemo(()=>{const o=K||[];return[{title:T("All"),key:"0",children:q(o,"0")}]},[K,q,T]),J=o=>{I(o),D(!1)},W=o=>{const{value:u}=o.target,i=n=>n.reduce((l,p)=>{var w;return(w=p.title)!=null&&w.includes(u)&&l.push(p),p.children?[...l,...i(p.children)]:l},[]),c=i(m).map(n=>n.key);I(c),G(u),D(!0),z([])},B=a.useMemo(()=>{if(!x)return m;const o=u=>{const i=[];for(const c of u){const n=c.title,l=n.indexOf(x),p=n.substring(0,l),w=n.substring(l+x.length),F=l>-1?r.jsxs("span",{children:[p,r.jsx("span",{style:{color:P.colorPrimary},children:x}),w]}):r.jsx("span",{children:n});if(l>-1)i.push(C(A({},c),{title:F}));else if(c.children){const N=o(c.children);N.length&&i.push(C(A({},c),{title:F,children:N}))}}return i};return o(m)},[x,m,P.colorPrimary]),X=()=>{const o=(i,c)=>i.reduce((n,l)=>{let p=l.title;return p=l.key==="0"?p:`${c}/${p}`,l.children?[...n,...o(l.children,l.key==="0"?"":p)]:(O.includes(l.key)&&l.key!=="0"&&n.push(p),n)},[]),u=o(m,"");u.length&&v.request({url:"logger:download",method:"post",responseType:"blob",data:{files:u}}).then(i=>{const c=window.URL.createObjectURL(new Blob([i.data],{type:"application/gzip"})),n=document.createElement("a");n.setAttribute("href",c),n.setAttribute("download","logs.tar.gz"),n.click(),n.remove()}).catch(i=>{console.log(i)})};return r.jsxs(d.Card,{style:{minHeight:"700px"},children:[r.jsx(d.Alert,{message:"",description:r.jsx(M,{}),type:"info",showIcon:!0}),r.jsx(d.Input.Search,{style:{marginTop:16,width:"450px"},placeholder:T("Search"),onChange:W}),r.jsx("div",{style:{maxHeight:"400px",width:"450px",overflow:"auto",border:"1px solid",marginTop:"6px",marginBottom:"10px",borderColor:P.colorBorder},children:B.length?r.jsx(d.Tree,{checkable:!0,showIcon:!0,showLine:!0,checkedKeys:O,expandedKeys:U,autoExpandParent:Q,onExpand:J,onCheck:o=>z(o),treeData:B}):r.jsx(d.Empty,{image:d.Empty.PRESENTED_IMAGE_SIMPLE})}),r.jsxs(d.Button,{type:"primary",onClick:X,children:[T("Download")," (.tar.gz)"]})]})});_.displayName="LogsDownloader";class j extends t.Plugin{afterAdd(){return S(this,null,function*(){})}beforeLoad(){return S(this,null,function*(){})}load(){return S(this,null,function*(){this.app.pluginSettingsManager.add("logger",{title:f("Logger"),icon:"FileTextOutlined",Component:_})})}}e.PluginLoggerClient=j,e.default=j,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -1,11 +1,11 @@
1
1
  module.exports = {
2
- "@nocobase/client": "0.20.0-alpha.5",
2
+ "@nocobase/client": "0.20.0-alpha.6",
3
3
  "react": "18.2.0",
4
4
  "antd": "5.12.8",
5
5
  "@ant-design/icons": "5.2.6",
6
6
  "ahooks": "3.7.8",
7
- "@nocobase/server": "0.20.0-alpha.5",
7
+ "@nocobase/server": "0.20.0-alpha.6",
8
8
  "react-i18next": "11.18.6",
9
- "@nocobase/actions": "0.20.0-alpha.5",
10
- "@nocobase/logger": "0.20.0-alpha.5"
9
+ "@nocobase/actions": "0.20.0-alpha.6",
10
+ "@nocobase/logger": "0.20.0-alpha.6"
11
11
  };
@@ -1 +1 @@
1
- {"name":"tar-fs","version":"3.0.4","description":"filesystem bindings for tar-stream","dependencies":{"mkdirp-classic":"^0.5.2","pump":"^3.0.0","tar-stream":"^3.1.5"},"files":["index.js"],"standard":{"ignore":["test/fixtures/**"]},"keywords":["tar","fs","file","tarball","directory","stream"],"devDependencies":{"brittle":"^3.1.3","rimraf":"^2.6.3","standard":"^17.0.1"},"scripts":{"test":"standard && brittle test/index.js"},"bugs":{"url":"https://github.com/mafintosh/tar-fs/issues"},"homepage":"https://github.com/mafintosh/tar-fs","main":"index.js","directories":{"test":"test"},"author":"Mathias Buus","license":"MIT","repository":{"type":"git","url":"https://github.com/mafintosh/tar-fs.git"},"_lastModified":"2024-03-05T16:28:47.216Z"}
1
+ {"name":"tar-fs","version":"3.0.4","description":"filesystem bindings for tar-stream","dependencies":{"mkdirp-classic":"^0.5.2","pump":"^3.0.0","tar-stream":"^3.1.5"},"files":["index.js"],"standard":{"ignore":["test/fixtures/**"]},"keywords":["tar","fs","file","tarball","directory","stream"],"devDependencies":{"brittle":"^3.1.3","rimraf":"^2.6.3","standard":"^17.0.1"},"scripts":{"test":"standard && brittle test/index.js"},"bugs":{"url":"https://github.com/mafintosh/tar-fs/issues"},"homepage":"https://github.com/mafintosh/tar-fs","main":"index.js","directories":{"test":"test"},"author":"Mathias Buus","license":"MIT","repository":{"type":"git","url":"https://github.com/mafintosh/tar-fs.git"},"_lastModified":"2024-03-08T02:31:37.241Z"}
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "displayName.zh-CN": "日志",
5
5
  "description": "Server-side logs, mainly including API request logs and system runtime logs, and allows to package and download log files.",
6
6
  "description.zh-CN": "服务端日志,主要包括接口请求日志和系统运行日志,并支持打包和下载日志文件。",
7
- "version": "0.20.0-alpha.5",
7
+ "version": "0.20.0-alpha.6",
8
8
  "license": "AGPL-3.0",
9
9
  "main": "dist/server/index.js",
10
10
  "homepage": "https://docs.nocobase.com/handbook/logger",
@@ -19,7 +19,7 @@
19
19
  "@nocobase/server": "0.x",
20
20
  "@nocobase/test": "0.x"
21
21
  },
22
- "gitHead": "b72d7fdf357a6bc4460ff181644b9014d3dad13b",
22
+ "gitHead": "281767b02ce11f9172fb72e5e53ff98bc80b6eaf",
23
23
  "keywords": [
24
24
  "Logging and monitoring"
25
25
  ]