Comments (4)
@iccicci need your help
from rotating-file-stream.
Hi @BARMPlus ,
I run this and I got no errors.
const path = require("path");
const { createStream } = require("rotating-file-stream");
const dir = "test";
const generator = (time, index) => {
const name = "web.log";
if(! time) return name;
const pad = num => (num > 9 ? "" : "0") + num;
const month = time.getFullYear() + "" + pad(time.getMonth() + 1);
const day = pad(time.getDate());
return `history/${month}${day}-${index}-${name}`;
};
const options = {
maxFiles: 7,
interval: "2s",
path: path.resolve(process.cwd(), dir)
};
const stream = createStream(generator, options);
setTimeout(() => {}, 600000);
let count = 0;
function write() {
stream.write(`write ${++count}\n`);
setTimeout(write, Math.random() * 10).unref();
}
write();
I'm sorry but I didn't got the point when you say:
When I request access to the log when I am about to rename the log, it is easy to get the above error.
If you meant you want to access the log file you are writing you might consider the immutable options or the rotation and rotated events: you may stop trying to access the log file between a rotation
and a rotated
events.
from rotating-file-stream.
Thank you, it's my problem, it has been solved
from rotating-file-stream.
I got save error, how do you resolve ?
from rotating-file-stream.
Related Issues (20)
- How to undo the operation of changing default shell for npm on windows 10 ? HOT 1
- Compressed rotated files don't have the `.gz` suffix HOT 3
- cannot find module "fs/promises" with nodejs 12.22.7 HOT 7
- While rotating log file gives EPERM: operation not permitted, stat error HOT 7
- how to create symlink HOT 3
- Cannot find module 'fs/promises' HOT 6
- Not able to compress log file HOT 3
- [bug] Cannot read properties of undefined (reading 'write') HOT 25
- Rotating log file with size, maxFiles and path options HOT 9
- Unhandled Error, No such file or directory, unlink called twice on same file. HOT 17
- The first rotated file is not specified time length. HOT 1
- Error: this.timeout.unref is not a function HOT 10
- while deploying the project i am getting this error please help HOT 7
- [bug] it does not create the file again when it's writing HOT 1
- Custom compressed file names HOT 4
- how do i do the unit testing in node js HOT 2
- Sometimes crashes on interval change HOT 3
- UTC: interval & intervalBoundary HOT 1
- Jumping from Node v14 to v18 between 3.1.1 and 3.2.0 HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rotating-file-stream.