Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

get_logger uses root directory file #784

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pyvcloud/vcd/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import sys
import time
import urllib
from tempfile import NamedTemporaryFile

from lxml import etree
from lxml import objectify
Expand Down Expand Up @@ -2184,7 +2185,7 @@ def create_element(node_name, value=None):
return element


def get_logger(file_name="vcd_sdk.log",
def get_logger(file_name=None,
log_level=logging.DEBUG,
max_bytes=10000000,
backup_count=10):
Expand Down Expand Up @@ -2212,6 +2213,9 @@ def get_logger(file_name="vcd_sdk.log",
:return: Logger with rotating file handler.
:type: LOGGER
"""
if not file_name:
tf_obj = NamedTemporaryFile(delete=False)
file_name = tf_obj.name
LOGGER = logging.getLogger(file_name)
logHandler = handlers.RotatingFileHandler(
filename=file_name, maxBytes=max_bytes, backupCount=backup_count)
Expand Down