mirror of
https://github.com/dimitri/pgloader.git
synced 2026-05-04 18:36:12 +02:00
Merge remote branch 'refs/remotes/dpanech/tempdir'
This commit is contained in:
commit
ef38322c97
@ -7,6 +7,7 @@ PostgreSQL data import tool, see included man page.
|
||||
|
||||
import os, sys, os.path, time, codecs, logging, threading
|
||||
from cStringIO import StringIO
|
||||
from tempfile import gettempdir
|
||||
|
||||
import pgloader.options
|
||||
import pgloader.tools
|
||||
@ -55,8 +56,8 @@ def parse_options():
|
||||
help = "loglevel to use: ERROR, WARNING, INFO, DEBUG")
|
||||
|
||||
parser.add_option("-L", "--logfile", dest = "logfile",
|
||||
default = "/tmp/pgloader.log",
|
||||
help = "log file, defauts to /tmp/pgloader.log")
|
||||
default = os.path.join (gettempdir(), "pgloader.log"),
|
||||
help = "log file, defauts to $TMPDIR/pgloader.log")
|
||||
|
||||
parser.add_option("-r", "--reject-log", dest = "reject_log",
|
||||
default = None,
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
|
||||
import os, sys, os.path, time, codecs, logging
|
||||
from cStringIO import StringIO
|
||||
from tempfile import gettempdir
|
||||
|
||||
from options import DRY_RUN, PEDANTIC, CLIENT_MIN_MESSAGES
|
||||
from options import TRUNCATE, VACUUM
|
||||
@ -378,7 +379,7 @@ ORDER BY attnum
|
||||
""" save copy buffer to a temporary file for further inspection """
|
||||
import tempfile
|
||||
(f, n) = tempfile.mkstemp(prefix='%s.' % tablename,
|
||||
suffix='.pgloader', dir='/tmp')
|
||||
suffix='.pgloader', dir=gettempdir())
|
||||
os.write(f, self.buffer.getvalue())
|
||||
os.close(f)
|
||||
if debug:
|
||||
|
||||
@ -7,9 +7,12 @@
|
||||
|
||||
from tools import PGLoader_Error
|
||||
import logging
|
||||
from tempfile import gettempdir
|
||||
import os
|
||||
|
||||
def init(client_min_messages = logging.INFO,
|
||||
log_min_messages = logging.DEBUG, filename = '/tmp/pgloader.log'):
|
||||
log_min_messages = logging.DEBUG,
|
||||
filename = os.path.join (gettempdir(), 'pgloader.log')):
|
||||
""" set the console logging """
|
||||
|
||||
fmt = '%(asctime)s %(name)-12s %(levelname)-8s %(message)s'
|
||||
|
||||
@ -2,6 +2,9 @@
|
||||
#
|
||||
# Some common options, for each module to get them
|
||||
|
||||
from tempfile import gettempdir
|
||||
import os
|
||||
|
||||
PGLOADER_VERSION = '2.3.3~dev2'
|
||||
|
||||
PSYCOPG_VERSION = None
|
||||
@ -48,7 +51,7 @@ RRQUEUE_SIZE = None
|
||||
|
||||
CLIENT_MIN_MESSAGES = None
|
||||
LOG_MIN_MESSAGES = DEBUG
|
||||
DEFAULT_LOG_FILE = "/tmp/pgloader.log"
|
||||
DEFAULT_LOG_FILE = os.path.join (gettempdir(), "pgloader.log")
|
||||
LOG_FILE = None
|
||||
|
||||
REJECT_LOG_FILE = '%s.rej.log'
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
|
||||
import os, sys, os.path, time, codecs, threading
|
||||
from cStringIO import StringIO
|
||||
from tempfile import gettempdir
|
||||
|
||||
from logger import log, getLogger
|
||||
from tools import PGLoader_Error, Reject, parse_config_string, check_events
|
||||
@ -242,10 +243,10 @@ class PGLoader(threading.Thread):
|
||||
self.reject_data = config.get(name, 'reject_data')
|
||||
|
||||
if not self.template and 'reject_log' not in self.__dict__:
|
||||
self.reject_log = os.path.join('/tmp', REJECT_LOG_FILE % name)
|
||||
self.reject_log = os.path.join(gettempdir(), REJECT_LOG_FILE % name)
|
||||
|
||||
if not self.template and 'reject_data' not in self.__dict__:
|
||||
self.reject_data = os.path.join('/tmp', REJECT_DATA_FILE % name)
|
||||
self.reject_data = os.path.join(gettempdir(), REJECT_DATA_FILE % name)
|
||||
|
||||
# reject logging
|
||||
if not self.template:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user