python info_Python logger.info方法代码示例

本文详细介绍了Python中utils.logger.info方法的多种应用场景,包括在训练模型、日志记录、数据处理等方面,提供了丰富的代码示例,帮助开发者理解和掌握如何在实际项目中有效利用该方法进行信息输出和调试。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

本文整理汇总了Python中utils.logger.info方法的典型用法代码示例。如果您正苦于以下问题:Python logger.info方法的具体用法?Python logger.info怎么用?Python logger.info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在模块utils.logger的用法示例。

在下文中一共展示了logger.info方法的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: end_epoch

​点赞 8

# 需要导入模块: from utils import logger [as 别名]

# 或者: from utils.logger import info [as 别名]

def end_epoch(self):

"""

Finally arrived at the end of epoch (full pass on dataset).

Do some tensorboard logging and checkpoint saving.

"""

logger.info(f"{self.n_sequences_epoch} sequences have been trained during this epoch.")

if self.is_master:

self.save_checkpoint(checkpoint_name=f"model_epoch_{self.epoch}.pth")

self.tensorboard.add_scalar(

tag="epoch/loss", scalar_value=self.total_loss_epoch / self.n_iter, global_step=self.epoch

)

self.epoch += 1

self.n_sequences_epoch = 0

self.n_iter = 0

self.total_loss_epoch = 0

开发者ID:monologg,项目名称:DistilKoBERT,代码行数:19,

示例2: __init__

​点赞 6

# 需要导入模块: from utils import logger [as 别名]

# 或者: from utils.logger import info [as 别名]

def __init__(self, args):

super(CEMLearner, self).__init__(args)

policy_conf = {'name': 'local_learning_{}'.format(self.actor_id),

'input_shape': self.input_shape,

'num_act': self.num_actions,

'args': args}

self.local_network = args.network(policy_conf)

self.num_params = np.sum([

np.prod(v.get_shape().as_list())

for v in self.local_network.params])

logger.info('Parameter count: {}'.format(self.num_params))

self.mu = np.zeros(self.num_params)

self.sigma = np.ones(self.num_params)

self.num_samples = args.episodes_per_batch

self.num_epochs = args.num_epochs

if self.is_master():

var_list = self.local_network.params

self.saver = tf.train.Saver(var_list=var_list, max_to_keep=3,

keep_checkpoint_every_n_hours=2)

开发者ID:steveKapturowski,项目名称:tensorflow-rl,代码行数:25,

示例3: _add_archives

​点赞 6

# 需要导入模块: from utils import logger [as 别名]

# 或者: from utils.logger import info [as 别名]

def _add_archives(self, collection):

logger.info("%s " % "article", False)

result = ""

archives = list(collection.find({}))

page_count = len(archives) / 10 + 1

result += self._add_one(

"archives",

datetime.now()

)

for index in xrange(page_count):

result += self._add_one(

"%s/%d" % ("archives", index),

datetime.now()

)

for article in archives:

result += self._add_one(

"%s/%s" % ("article", article["slug"]),

datetime.strptime(article["date"], "%Y.%m.%d %H:%M")

)

return result

开发者ID:dtysky,项目名称:BlogReworkPro,代码行数:22,

示例4: generate

​点赞 6

# 需要导入模块: from utils import logger [as 别名]

# 或者: from utils.logger import info [as 别名]

def generate(self):

logger.info("Sitemap: Writing start...")

with open(config["sitemap_path"], "w") as f:

f.write(template["begin"])

f.write(self._add_static())

logger.info("Sitemap: Writing: ")

for url in ["tag", "author", "category"]:

f.write(

self._add_collection(url, self._collections[url])

)

f.write(

self._add_archives(self._collections["article"])

)

f.write(template["end"])

f.close()

logger.info("Sitemap: Writing done...")

开发者ID:dtysky,项目名称:BlogReworkPro,代码行数:18,

示例5: _update_files

​点赞 6

# 需要导入模块: from utils import logger [as 别名]

# 或者: from utils.logger import info [as 别名]

def _update_files(self, file_names, time):

if not os.path.exists(config["feeds_dir_path"]):

os.mkdir(config["feeds_dir_path"])

for name_pair in file_names:

name, view = name_pair["slug"].encode("utf-8"), name_pair["view"].encode("utf-8")

if name not in self._files:

file_name = "%s/%s.rss.xml" % (

config["feeds_dir_path"],

name

)

self._files[name] = open(file_name, "w")

self._files[name].write(

template["begin"].format(

config["site_title"],

config["site_url"],

config["site_description"],

"%s/%s" % (

config["site_url"],

file_name

),

time

)

)

logger.info("'%s' " % view, False)

开发者ID:dtysky,项目名称:BlogReworkPro,代码行数:26,

示例6: write

​点赞 6

# 需要导入模块: from utils import logger [as 别名]

# 或者: from utils.logger import info [as 别名]

def write(self, file_path, mode="delete", page=None):

logger.info("Writing start: %s" % file_path)

self._file_path = file_path

if mode != "delete" and page == None:

self._error("Mode is not 'delete', argument 'page' is required !")

if mode == "update":

if self._articles.find_one(

{

"file": file_path

}

):

self._update(file_path, page)

else:

self._insert(page)

elif mode == "delete":

self._delete(file_path)

else:

self._error("Unexpected mode '%s' !" % mode)

开发者ID:dtysky,项目名称:BlogReworkPro,代码行数:21,

示例7: __init__

​点赞 5

# 需要导入模块: from utils import logger [as 别名]

# 或者: from utils.logger import info [as 别名]

def __init__(self, name, is_train, norm='instance', activation='leaky',

image_size=128, latent_dim=8, use_resnet=True):

logger.info('Init Encoder %s', name)

self.name = name

self._is_train = is_train

self._norm = norm

self._activation = activation

self._reuse = False

self._image_size = image_size

self._latent_dim = latent_dim

self._use_resnet = use_resnet

开发者ID:clvrai,项目名称:BicycleGAN-Tensorflow,代码行数:13,

示例8: __init__

​点赞 5

# 需要导入模块: from utils import logger [as 别名]

# 或者: from utils.logger import info [as 别名]

def __init__(self, name, is_train, norm='instance', activation='leaky', image_size=128):

logger.info('Init Discriminator %s', name)

self.name = name

self._is_train = is_train

self._norm = norm

self._activation = activation

self._reuse = False

self._image_size = image_size

开发者ID:clvrai,项目名称:BicycleGAN-Tensorflow,代码行数:10,

示例9: __init__

​点赞 5

# 需要导入模块: from utils import logger [as 别名]

# 或者: from utils.logger import info [as 别名]

def __init__(self, name, is_train, norm='batch', image_size=128):

logger.info('Init Generator %s', name)

self.name = name

self._is_train = is_train

self._norm = norm

self._reuse = False

self._image_size = image_size

开发者ID:clvrai,项目名称:BicycleGAN-Tensorflow,代码行数:9,

示例10: __init__

​点赞 5

# 需要导入模块: from utils import logger [as 别名]

# 或者: from utils.logger import info [as 别名]

def __init__(self, name, is_train, norm='instance', activation='leaky'):

logger.info('Init Discriminator %s', name)

self.name = name

self._is_train = is_train

self._norm = norm

self._activation = activation

self._reuse = False

开发者ID:clvrai,项目名称:CycleGAN-Tensorflow,代码行数:9,

示例11: __init__

​点赞 5

# 需要导入模块: from utils import logger [as 别名]

# 或者: from utils.logger import info [as 别名]

def __init__(self, name, is_train, norm='instance', activation='relu',

image_size=128):

logger.info('Init Generator %s', name)

self.name = name

self._is_train = is_train

self._norm = norm

self._activation = activation

self._num_res_block = 6 if image_size == 128 else 9

self._reuse = False

开发者ID:clvrai,项目名称:CycleGAN-Tensorflow,代码行数:11,

示例12: remove_long_sequences

​点赞 5

# 需要导入模块: from utils import logger [as 别名]

# 或者: from utils.logger import info [as 别名]

def remove_long_sequences(self):

"""

Sequences that are too long are splitted by chunk of max_model_input_size.

"""

max_len = self.params.max_model_input_size

indices = self.lengths > max_len

logger.info(f"Splitting {sum(indices)} too long sequences.")

def divide_chunks(l, n):

return [l[i : i + n] for i in range(0, len(l), n)]

new_tok_ids = []

new_lengths = []

if self.params.mlm:

cls_id, sep_id = self.params.special_tok_ids["cls_token"], self.params.special_tok_ids["sep_token"]

else:

cls_id, sep_id = self.params.special_tok_ids["bos_token"], self.params.special_tok_ids["eos_token"]

for seq_, len_ in zip(self.token_ids, self.lengths):

assert (seq_[0] == cls_id) and (seq_[-1] == sep_id), seq_

if len_ <= max_len:

new_tok_ids.append(seq_)

new_lengths.append(len_)

else:

sub_seqs = []

for sub_s in divide_chunks(seq_, max_len - 2):

if sub_s[0] != cls_id:

sub_s = np.insert(sub_s, 0, cls_id)

if sub_s[-1] != sep_id:

sub_s = np.insert(sub_s, len(sub_s), sep_id)

assert len(sub_s) <= max_len

assert (sub_s[0] == cls_id) and (sub_s[-1] == sep_id), sub_s

sub_seqs.append(sub_s)

new_tok_ids.extend(sub_seqs)

new_lengths.extend([len(l) for l in sub_seqs])

self.token_ids = np.array(new_tok_ids)

self.lengths = np.array(new_lengths)

开发者ID:bhoov,项目名称:exbert,代码行数:41,

示例13: remove_empty_sequences

​点赞 5

# 需要导入模块: from utils import logger [as 别名]

# 或者: from utils.logger import info [as 别名]

def remove_empty_sequences(self):

"""

Too short sequences are simply removed. This could be tunedd.

"""

init_size = len(self)

indices = self.lengths > 11

self.token_ids = self.token_ids[indices]

self.lengths = self.lengths[indices]

new_size = len(self)

logger.info(f"Remove {init_size - new_size} too short (<=11 tokens) sequences.")

开发者ID:bhoov,项目名称:exbert,代码行数:12,

示例14: remove_unknown_sequences

​点赞 5

# 需要导入模块: from utils import logger [as 别名]

# 或者: from utils.logger import info [as 别名]

def remove_unknown_sequences(self):

"""

Remove sequences with a (too) high level of unknown tokens.

"""

if "unk_token" not in self.params.special_tok_ids:

return

else:

unk_token_id = self.params.special_tok_ids["unk_token"]

init_size = len(self)

unk_occs = np.array([np.count_nonzero(a == unk_token_id) for a in self.token_ids])

indices = (unk_occs / self.lengths) < 0.5

self.token_ids = self.token_ids[indices]

self.lengths = self.lengths[indices]

new_size = len(self)

logger.info(f"Remove {init_size - new_size} sequences with a high level of unknown tokens (50%).")

开发者ID:bhoov,项目名称:exbert,代码行数:17,

示例15: print_statistics

​点赞 5

# 需要导入模块: from utils import logger [as 别名]

# 或者: from utils.logger import info [as 别名]

def print_statistics(self):

"""

Print some statistics on the corpus. Only the master process.

"""

if not self.params.is_master:

return

logger.info(f"{len(self)} sequences")

# data_len = sum(self.lengths)

# nb_unique_tokens = len(Counter(list(chain(*self.token_ids))))

# logger.info(f'{data_len} tokens ({nb_unique_tokens} unique)')

# unk_idx = self.params.special_tok_ids['unk_token']

# nb_unkown = sum([(t==unk_idx).sum() for t in self.token_ids])

# logger.info(f'{nb_unkown} unknown tokens (covering {100*nb_unkown/data_len:.2f}% of the data)')

开发者ID:bhoov,项目名称:exbert,代码行数:16,

示例16: train

​点赞 5

# 需要导入模块: from utils import logger [as 别名]

# 或者: from utils.logger import info [as 别名]

def train(self):

"""

The real training loop.

"""

if self.is_master:

logger.info("Starting training")

self.last_log = time.time()

self.student.train()

self.teacher.eval()

for _ in range(self.params.n_epoch):

if self.is_master:

logger.info(f"--- Starting epoch {self.epoch}/{self.params.n_epoch-1}")

if self.multi_gpu:

torch.distributed.barrier()

iter_bar = tqdm(self.dataloader, desc="-Iter", disable=self.params.local_rank not in [-1, 0])

for batch in iter_bar:

if self.params.n_gpu > 0:

batch = tuple(t.to(f"cuda:{self.params.local_rank}") for t in batch)

if self.mlm:

token_ids, attn_mask, lm_labels = self.prepare_batch_mlm(batch=batch)

else:

token_ids, attn_mask, lm_labels = self.prepare_batch_clm(batch=batch)

self.step(input_ids=token_ids, attention_mask=attn_mask, lm_labels=lm_labels)

iter_bar.update()

iter_bar.set_postfix(

{"Last_loss": f"{self.last_loss:.2f}", "Avg_cum_loss": f"{self.total_loss_epoch/self.n_iter:.2f}"}

)

iter_bar.close()

if self.is_master:

logger.info(f"--- Ending epoch {self.epoch}/{self.params.n_epoch-1}")

self.end_epoch()

if self.is_master:

logger.info(f"Save very last checkpoint as `pytorch_model.bin`.")

self.save_checkpoint(checkpoint_name=f"pytorch_model.bin")

logger.info("Training is finished")

开发者ID:bhoov,项目名称:exbert,代码行数:43,

示例17: create_lengths_groups

​点赞 5

# 需要导入模块: from utils import logger [as 别名]

# 或者: from utils.logger import info [as 别名]

def create_lengths_groups(lengths, k=0):

bins = np.arange(start=3, stop=k, step=4).tolist() if k > 0 else [10]

groups = _quantize(lengths, bins)

# count number of elements per group

counts = np.unique(groups, return_counts=True)[1]

fbins = [0] + bins + [np.inf]

logger.info("Using {} as bins for aspect lengths quantization".format(fbins))

logger.info("Count of instances per bin: {}".format(counts))

return groups

开发者ID:bhoov,项目名称:exbert,代码行数:11,

示例18: remove_long_sequences

​点赞 5

# 需要导入模块: from utils import logger [as 别名]

# 或者: from utils.logger import info [as 别名]

def remove_long_sequences(self):

"""

Sequences that are too long are splitted by chunk of max_model_input_size.

"""

max_len = self.params.max_model_input_size

indices = self.lengths > max_len

logger.info(f'Splitting {sum(indices)} too long sequences.')

def divide_chunks(l, n):

return [l[i:i + n] for i in range(0, len(l), n)]

new_tok_ids = []

new_lengths = []

if self.params.mlm:

cls_id, sep_id = self.params.special_tok_ids['cls_token'], self.params.special_tok_ids['sep_token']

else:

cls_id, sep_id = self.params.special_tok_ids['bos_token'], self.params.special_tok_ids['eos_token']

for seq_, len_ in zip(self.token_ids, self.lengths):

assert (seq_[0] == cls_id) and (seq_[-1] == sep_id), seq_

if len_ <= max_len:

new_tok_ids.append(seq_)

new_lengths.append(len_)

else:

sub_seqs = []

for sub_s in divide_chunks(seq_, max_len-2):

if sub_s[0] != cls_id:

sub_s = np.insert(sub_s, 0, cls_id)

if sub_s[-1] != sep_id:

sub_s = np.insert(sub_s, len(sub_s), sep_id)

assert len(sub_s) <= max_len

assert (sub_s[0] == cls_id) and (sub_s[-1] == sep_id), sub_s

sub_seqs.append(sub_s)

new_tok_ids.extend(sub_seqs)

new_lengths.extend([len(l) for l in sub_seqs])

self.token_ids = np.array(new_tok_ids)

self.lengths = np.array(new_lengths)

开发者ID:monologg,项目名称:DistilKoBERT,代码行数:41,

示例19: remove_empty_sequences

​点赞 5

# 需要导入模块: from utils import logger [as 别名]

# 或者: from utils.logger import info [as 别名]

def remove_empty_sequences(self):

"""

Too short sequences are simply removed. This could be tunedd.

"""

init_size = len(self)

indices = self.lengths > 11

self.token_ids = self.token_ids[indices]

self.lengths = self.lengths[indices]

new_size = len(self)

logger.info(f'Remove {init_size - new_size} too short (<=11 tokens) sequences.')

开发者ID:monologg,项目名称:DistilKoBERT,代码行数:12,

示例20: print_statistics

​点赞 5

# 需要导入模块: from utils import logger [as 别名]

# 或者: from utils.logger import info [as 别名]

def print_statistics(self):

"""

Print some statistics on the corpus. Only the master process.

"""

if not self.params.is_master:

return

logger.info(f'{len(self)} sequences')

# data_len = sum(self.lengths)

# nb_unique_tokens = len(Counter(list(chain(*self.token_ids))))

# logger.info(f'{data_len} tokens ({nb_unique_tokens} unique)')

# unk_idx = self.params.special_tok_ids['unk_token']

# nb_unkown = sum([(t==unk_idx).sum() for t in self.token_ids])

# logger.info(f'{nb_unkown} unknown tokens (covering {100*nb_unkown/data_len:.2f}% of the data)')

开发者ID:monologg,项目名称:DistilKoBERT,代码行数:16,

示例21: write_density_model

​点赞 5

# 需要导入模块: from utils import logger [as 别名]

# 或者: from utils.logger import info [as 别名]

def write_density_model(self):

logger.info('T{} Writing Pickled Density Model to File...'.format(self.actor_id))

raw_data = cPickle.dumps(self.density_model.get_state(), protocol=2)

with self.barrier.counter.lock, open('/tmp/density_model.pkl', 'wb') as f:

f.write(raw_data)

for i in xrange(len(self.density_model_update_flags.updated)):

self.density_model_update_flags.updated[i] = 1

开发者ID:steveKapturowski,项目名称:tensorflow-rl,代码行数:10,

示例22: read_density_model

​点赞 5

# 需要导入模块: from utils import logger [as 别名]

# 或者: from utils.logger import info [as 别名]

def read_density_model(self):

logger.info('T{} Synchronizing Density Model...'.format(self.actor_id))

with self.barrier.counter.lock, open('/tmp/density_model.pkl', 'rb') as f:

raw_data = f.read()

self.density_model.set_state(cPickle.loads(raw_data))

开发者ID:steveKapturowski,项目名称:tensorflow-rl,代码行数:8,

示例23: test

​点赞 5

# 需要导入模块: from utils import logger [as 别名]

# 或者: from utils.logger import info [as 别名]

def test(self, num_episodes=100):

"""

Run test monitor for `num_episodes`

"""

rewards = list()

for episode in range(num_episodes):

s = self.emulator.get_initial_state()

self.reset_hidden_state()

total_episode_reward = 0

episode_over = False

while not episode_over:

a = self.choose_next_action(s)[0]

s, reward, episode_over = self.emulator.next(a)

total_episode_reward += reward

else:

rewards.append(total_episode_reward)

logger.info("EPISODE {0} -- REWARD: {1}, RUNNING AVG: {2:.1f}±{3:.1f}, BEST: {4}".format(

episode,

total_episode_reward,

np.array(rewards).mean(),

2*np.array(rewards).std(),

max(rewards),

))

开发者ID:steveKapturowski,项目名称:tensorflow-rl,代码行数:28,

示例24: _handle

​点赞 5

# 需要导入模块: from utils import logger [as 别名]

# 或者: from utils.logger import info [as 别名]

def _handle(self, parameters=None):

hasOrigin = "origin" in request.headers

logger.info("Request: %s\nFrom: %s\nUrl: %s" % (

self.url,

request.headers["Referer"] if hasOrigin else request.remote_addr,

request.url

))

if hasOrigin and (request.headers["origin"] not in config["allow-origin"]):

return self._403(parameters)

if not (request.remote_addr in config["allow-ip"]):

return self._403(parameters)

params = self._parse_parameters(parameters)

cache = self._cache

if cache != None and cache.has(params) and not cache.is_modified(params):

return self._304(params, cache.get(params))

data = self._find_data(params)

if not data:

return self._404(parameters)

logger.info("Data found: %s\nParameters: %s" % (

self.url, parameters

))

if cache != None:

cache.updateContent(params, data)

return self._response(

self._format_data(200, data, self.url, params),

200

)

开发者ID:dtysky,项目名称:BlogReworkPro,代码行数:35,

示例25: _304

​点赞 5

# 需要导入模块: from utils import logger [as 别名]

# 或者: from utils.logger import info [as 别名]

def _304(self, parameters, data):

logger.info("304: %s\nParameters: %s" % (

self.url, parameters

))

return self._response(

self._format_data(304, data, self.url, parameters),

200

)

开发者ID:dtysky,项目名称:BlogReworkPro,代码行数:10,

示例26: _add_collection

​点赞 5

# 需要导入模块: from utils import logger [as 别名]

# 或者: from utils.logger import info [as 别名]

def _add_collection(self, url, collection):

logger.info("%s " % url, False)

result = ""

for item in list(collection.find({})):

result += self._add_one(

"%s/%s" % (url, item["slug"]),

datetime.now()

)

for index in xrange(item["count"] / config["articles_per_page"] + 1):

result += self._add_one(

"%s/%s/%d" % (url, item["slug"], index),

datetime.now()

)

return result

开发者ID:dtysky,项目名称:BlogReworkPro,代码行数:16,

示例27: wrap

​点赞 5

# 需要导入模块: from utils import logger [as 别名]

# 或者: from utils.logger import info [as 别名]

def wrap(self, metadata):

logger.info("Wrapping start")

return self._slug_wrap(metadata)

开发者ID:dtysky,项目名称:BlogReworkPro,代码行数:5,

示例28: generate

​点赞 5

# 需要导入模块: from utils import logger [as 别名]

# 或者: from utils.logger import info [as 别名]

def generate(self):

logger.info("Feeds: Writing start...")

self._files = {}

time = format_date(datetime.now(), "feeds")

articles = list(self._collection.find({}))

articles.sort(

key=lambda article: article["date"],reverse=True

)

logger.info("Feeds: Writing: ")

for article in articles:

content, file_names = self._format_article(article)

self._update_files(file_names, time)

for name in file_names:

self._files[name["slug"].encode("utf-8")].write(

self._add_one(content)

)

indexes = {}

logger.info("Feeds: Done: ")

for file_name, file_obj in self._files.items():

file_obj.write(

template["end"]

)

file_obj.close()

indexes[file_name] = "%s.rss.xml" % file_name

logger.info("'%s' " % file_name, False)

with open(

"%s/%s" % (

config["feeds_dir_path"],

"indexes.json"

),

"w"

) as f:

json.dump(indexes ,f)

logger.info("Feeds: Writing done...")

开发者ID:dtysky,项目名称:BlogReworkPro,代码行数:36,

示例29: updateContent

​点赞 5

# 需要导入模块: from utils import logger [as 别名]

# 或者: from utils.logger import info [as 别名]

def updateContent(self, parameters, content):

name = parameters

logger.info("Cache: %s - %s\nParams: %s" % ("update", self.flag, parameters))

self._cache[name] = content

self._state[name] = False

开发者ID:dtysky,项目名称:BlogReworkPro,代码行数:7,

注:本文中的utils.logger.info方法示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。

Python的logging模块中,`logger.warning`和`logger.warn`都是用于记录警告级别的日志信息,但它们之间存在一些细微的区别。以下是对这两者的详细比较: 1. **历史背景** - **logger.warning**:这是Python logging模块中一直存在的用于记录警告级别日志的方法。 - **logger.warn**:在早期的Python版本中(如Python 2.6之前),logging模块提供了warn方法用于记录警告级别的日志信息。然而,从Python 2.6开始,该方法被废弃,并推荐使用warning方法代替。 2. **使用方法** - **logger.warning**:这是推荐使用的记录警告级别日志的方法。它接受一个字符串参数作为日志消息,并输出到控制台或指定的日志文件。 - **logger.warn**:虽然在早期版本中可用,但在现代Python编程中已不推荐使用。如果尝试使用该方法,可能会收到弃用警告。 3. **示例代码** - **logger.warning**: ```python import logging logging.basicConfig(level=logging.WARNING) logger = logging.getLogger(__name__) logger.warning("This is a warning message.") ``` - **logger.warn**(不推荐): ```python import logging logging.basicConfig(level=logging.WARNING) logger = logging.getLogger(__name__) logger.warn("This is a warning message.") # 不推荐使用 ``` 综上所述,`logger.warning`是记录警告级别日志的推荐方法,而`logger.warn`已被废弃并不推荐使用。为了保持代码的规范性和可读性,建议在新的开发中始终使用`logger.warning`来记录警告级别的日志信息。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值