'Construct a status.log entry.
:param status_code: A message status code. Must match the codes
accepted by autotest.shared.log.is_valid_status.
:param subdir: A valid job subdirectory, or None.
:param operation: Description of the operation, or None.
:param message: A printable string describing event to be recorded.
:param fields: A dictionary of arbitrary alphanumeric key=value pairs
to be included in the log, or None.
:param timestamp: An optional integer timestamp, in the same format
as a time.time() timestamp. If unspecified, the
current time is used.
:raises: :class:`ValueError` if any of the parameters are invalid'

def __init__(self, status_code, subdir, operation, message, fields, timestamp=None):

    if (not log.is_valid_status(status_code)):
        raise ValueError(('status    code    %r    is    not    valid' % status_code))
    self.status_code = status_code
    if (subdir and self.BAD_CHAR_REGEX.search(subdir)):
        raise ValueError('Invalid    character    in    subdir    string')
    self.subdir = subdir
    if (operation and self.BAD_CHAR_REGEX.search(operation)):
        raise ValueError('Invalid    character    in    operation    string')
    self.operation = operation
    message_lines = message.split('\n')
    self.message = message_lines[0].replace(' DCTB ', ('    ' * 8))
    self.extra_message_lines = message_lines[1:]
    if self.BAD_CHAR_REGEX.search(self.message):
        raise ValueError(('Invalid    character    in    message    %r' % self.message))
    if (not fields):
        self.fields = {}
    else:
        self.fields = fields.copy()
    for (key, value) in self.fields.iteritems():
        if (type(value) is int):
            value = str(value)
        if self.BAD_CHAR_REGEX.search((key + value)):
            raise ValueError(('Invalid    character    in    %r=%r    field' % (key, value)))
    if (timestamp is None):
        timestamp = int(time.time())
    self.fields[self.TIMESTAMP_FIELD] = str(timestamp)
    self.fields[self.LOCALTIME_FIELD] = time.strftime('%b    %d    %H:%M:%S', time.localtime(timestamp))
