what is the proper way to do logging in csv file?

Posted by user2003548 on Stack Overflow See other posts from Stack Overflow or by user2003548
Published on 2013-11-04T09:50:57Z Indexed on 2013/11/04 9:53 UTC
Read the original article Hit count: 290

Filed under:
|
|
|

i want to log some information of every single request send to a busy http server in a formatted form,use log module would create some thing i don't want to:

[I 131104 15:31:29 Sys:34]

i think of csv format but i don't know how to customize it,and python got csv module,but read the manual

import csv
with open('some.csv', 'w', newline='') as f:
    writer = csv.writer(f)
    writer.writerows(someiterable)

since it would open and close a file each time, i am afraid in this way would slow down the whole server performance, what could i do?

© Stack Overflow or respective owner

Related posts about python

Related posts about logging